Closed lambdam94 closed 3 years ago
Not understanding - please could you clarify
in position definition
and
and
should give the same thing.
Is the issue any object with a non default position is not exported correctly unless units = mm?
Have tried changing the position of a GDMLBox via FreeCAD preferences and even if I enter 1M it changes to 1000mm. How are you changing position to get a non mm value.
Hello Keith
sorry about the bad message, the preview is a good option...
It will be better with some exemples. It is a small box in a world with a delta z =5um. If we write a "delta z =5e-6 m", the delta z is considered equal to 0.
exempleDelta5um is ok exempleDelta5e-6m is nok
exempleDelta5um.gdml.txt exempleDelta5e-6m.gdml.txt
In exempleDelta5e-6m.gdml, it seems that "m" is considered "mm".
Regards Dam
Just come across this which may or may not be relevant - Anyway posting link here just in case https://forum.freecadweb.org/viewtopic.php?f=10&t=48451
Hello Keith,
Your link seems to be a good solution in order to manage the different types of length.
I found the solution of this issue in def getMult(fp) in GDMLShared. Here 'unit' in fp.attrib is not well read. hasattr(fp,'unit') and unit = fp.unit don't give the same thing.
If you add these 2 lines (on lines147), it seems working elif 'unit' in fp.attrib : unit = fp.attrib['unit'] elif 'lunit' in fp.attrib : unit = fp.attrib['lunit']
cf. a solution: getMult.txt
Could you please add this to main code? Thanks!
Regards Dam
Have updated - hopefully now okay.
Yes, It is ok. Thanks!
Regards Dam
Tried importing lhcbvelo.gdml and these changes cause errors with Polycone
str object has no attribute attrib
GDMLShared.py line 147
Code changed to
if hasattr(fp,'lunit') : trace('lunit : '+fp.lunit) unit = fp.lunit elif hasattr(fp,'unit') : trace('unit : '+fp.unit) unit = fp.unit elif hasattr(fp,'attrib') : if 'unit' in fp.attrib : unit = fp.attrib['unit'] elif 'lunit' in fp.attrib : unit = fp.attrib['lunit'] else : return 1
With the hasattr(fp,'attrib') test, it seems like before! Regards Dam
"With the hasattr(fp,'attrib') test, it seems like before!"
Like before?
It behaves like before your code is added ? i.e. fixes nothing.
Fix in the today version.
Hello Keith
in position definition
and
and
should give the same thing.
But only, unit="mm" gives the good position. It seems that unit is not taken into account. Freecad IHM shows only 2 numbers after comma, so "0.000075mm" appears "0.00mm" (even if 000075mm is writen in the file).
Could you take a look? Thanks!
Regards Dam