mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-10 08:08:36 +08:00
Possibility for adding LengthUnit info to XCAF document using special class XCAFDoc_LenghtUnit and XCAFDoc_LenghtUnitTool is implemented. Package UnitsMethods is split: geom methods were placed to new file GeomConvert_Units which is in the toolkit TKXSBase, internal step scale factors was placed to StepData. Updated UnitMethods to convert scale factor to different unit types. Now, XSAlgo::XSAlgo_AlgoContainer is used to update unit info from static interface values. New Draw command "XSetLengthUnit" and "XGetLengthUnit" for set or get XDE attribute. Upgraded tests for STEP, IGES, OBJ, glTF, VRML formats to check area regressing with used unit. Upgraded tests\de test cases to use any units in the "loop back" algorithms.
35 lines
1009 B
Plaintext
35 lines
1009 B
Plaintext
puts "========"
|
|
puts "0030953: Data Exchange - implement export of mesh data into glTF 2.0 format"
|
|
puts "Test case exporting glTF model into glTF file."
|
|
puts "========"
|
|
|
|
Close D1 -silent
|
|
XNewDoc D1
|
|
XSetLengthUnit D1 cm
|
|
ReadGltf D1 [locate_data_file bug30691_DamagedHelmet.gltf] -nocreatedoc
|
|
XGetOneShape s1 D1
|
|
set aLProps1 [uplevel #0 sprops $s1]
|
|
|
|
set aTmpGltfBase "${imagedir}/${casename}_tmp"
|
|
set aTmpGltf "${aTmpGltfBase}.gltf"
|
|
lappend occ_tmp_files $aTmpGltf
|
|
lappend occ_tmp_files "${aTmpGltfBase}.bin"
|
|
lappend occ_tmp_files "${aTmpGltfBase}_textures"
|
|
|
|
WriteGltf D1 "$aTmpGltf"
|
|
|
|
Close D -silent
|
|
XNewDoc D
|
|
XSetLengthUnit D cm
|
|
ReadGltf D "$aTmpGltf" -nocreatedoc
|
|
|
|
XGetOneShape s D
|
|
set aLProps2 [uplevel #0 sprops $s]
|
|
checknbshapes s -face 1 -compound 0
|
|
checktrinfo s -tri 15452 -nod 14556
|
|
regexp {Mass\s:\s*([0-9\.]+)} $aLProps1 dummy anArea1
|
|
regexp {Mass\s:\s*([0-9\.]+)} $aLProps2 dummy anArea2
|
|
if {abs($anArea1 - $anArea2) > 1e-8 * $anArea1} {
|
|
puts "Error: invalid area $anArea1 instead of $anArea2"
|
|
}
|