1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
dpasukhi da80ff68f1 0031382: Data Exchange - BinXCAF should preserve length unit information
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.
2021-08-20 20:30:11 +03:00

44 lines
1.1 KiB
Plaintext

puts "========"
puts "0029303: Data Exchange - add RWObj_CafWriter tool for wavefront OBJ file"
puts "Write textured plane OBJ model into OBJ file"
puts "========"
pload XDE OCAF MODELING VISUALIZATION
Close D -silent
Close D1 -silent
XNewDoc D1
XSetLengthUnit D1 cm
ReadObj D1 [locate_data_file "P-51 Mustang.obj"] -nocreatedoc -unit 1
XGetOneShape s1 D1
set aLProps1 [uplevel #0 sprops $s1]
set aTmpObjBase "${imagedir}/${casename}_tmp"
set aTmpObj "${aTmpObjBase}.obj"
lappend occ_tmp_files $aTmpObj
lappend occ_tmp_files "${aTmpObjBase}.mtl"
lappend occ_tmp_files "${aTmpObjBase}_textures"
WriteObj D1 "$aTmpObj"
XNewDoc D
XSetLengthUnit D cm
ReadObj D "$aTmpObj" -nocreatedoc -unit 1
XGetOneShape s D
set aLProps2 [uplevel #0 sprops $s]
checknbshapes s -face 14 -compound 1
checktrinfo s -tri 4309 -nod 4727
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"
}
vclear
vinit View1
XDisplay -dispMode 1 D
vaxo
vfit
vdump ${imagedir}/${casename}.png