freecad_python_gdml's People
freecad_python_gdml's Issues
Need to support quantity in define section
Process internal XML entities before processing DOM on import
Currently the importing of gdml files with XML entities (supported by GDML in Geant4 per user guide) results in throwing an error due to failure to parse the entity. Here I'm just using a single value entity &length;. Error produced upon import is:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 60, in insert
processGDML(filename)
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 223, in processGDML
parseVolume(root,ref,0,0,0)
<type 'exceptions.TypeError'>: parseVolume() takes exactly 3 arguments (5 given)
GDML input file:
https://gist.github.com/wdconinc/5608821687745aa701391229d5b6504c
Sample File GDMLBox has extra small box ( not selectable)
Sample File GDMLBox has extra small box ( not selectable)
Change GetVal to take type as a parameter, default float
Change the GetVal function to have a additional parameter of type for return type (default 1 for float or 2 for int)
Issue for discussing the scan branch for processing large files
Please add your feedback on the scan branch to this issue.
Like is it useful?
Rather than volume depth should a straight numerical limit of volumes processed be used
Import: placement of physvol without position or rotation should assume zero and identity
Currently importing a physvol block like:
<physvol name="box_physical">
<volumeref ref="box_logical"/>
</physvol>
fails with (first)
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 212, in parsePhysVol
lx += float(eval(pos.get('x')))
TypeError: eval() arg 1 must be a string or code object
then with
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 109, in processPlacement
print angle
UnboundLocalError: local variable 'angle' referenced before assignment
and only works when:
<physvol name="box_physical">
<volumeref ref="box_logical"/>
<position name="box_position" x="0" y="0" z="0"/>
<rotation name="box_rotation" x="0" y="0" z="0"/>
</physvol>
Likely fix:
def processPlacement(base,rot) :
print "Rotation : "
print rot.attrib
axis = FreeCAD.Vector(0,0,1)
angle = 0
if 'y' in rot.attrib :
axis = FreeCAD.Vector(0,1,0)
angle = float(rot.attrib['y'])
if 'x' in rot.attrib :
axis = FreeCAD.Vector(1,0,0)
angle = float(rot.attrib['x'])
if 'z' in rot.attrib :
axis = FreeCAD.Vector(0,0,1)
angle = float(rot.attrib['z'])
print angle
place = FreeCAD.Placement(base,axis,angle)
return place
Sort out exporting to STEP format
Sort out exporting to STEP format
lxml pb under FreeCAD_0.19-20310
Hello,
I tried to used FreeCAD_Python_GDML. So I have donwloaded the last FreeCAD version available 0.19
But with FreeCAD_Python_GDML, a error occured :
File "/home/.../.FreeCAD/Mod/GDML/freecad/gdml/importGDML.py", line 977, in processGDML
from lxml import etree
<class 'ModuleNotFoundError'>: No module named 'lxml'
could you help?
Thanks!
Regards
Copying physical volume makes volume invalid
After copying a selection (physical volume) in FreeCAD, the pasted part cannot be exported, with the following error:
17:01:54 ====> Start GDML Export 0.1
17:01:54 File extension : .xml
17:01:54 clean name : LowerBoxPhys
17:01:54 returning name : LowerBoxPhys
17:01:54 Traceback (most recent call last):
File "<string>", line 4, in <module>
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 2208, in export
exportGDML(first,filepath,'.xml')
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1954, in exportGDML
exportWorldVol(first, fileExt)
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1905, in exportWorldVol
processVolume( cnt, vol, xmlVol, xmlParent, parentName, False)
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1829, in processVolume
idx = processObject(cnt, idx, vol.OutList[idx], \
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1650, in processObject
solidCnt, solidxml, solidName = processSolid(obj, True)
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1330, in processSolid
solidxml, solidName = processGDMLSolid(obj, True)
File "C:\Users\shang\AppData\Roaming\FreeCAD\Mod\GDML\freecad\gdml\exportGDML.py", line 1207, in processGDMLSolid
while switch(obj.Proxy.Type) :
<class 'AttributeError'>: 'GDMLBox' object has no attribute 'Type'
Use default world material vacuum instead of air
Instead of the current default of G4_Air (which relies on a whole bunch of isotopes, elements, etc), it may make more sense to use G4_Galactic as the default material for the world, e.g. defined on L1807 at http://www.apc.univ-paris7.fr/~franco/g4doxy/html/G4NistMaterialBuilder_8cc-source.html. Equivalent block in gdml is:
<material Z="1" name="G4_Galactic" state="gas">
<T unit="K" value="2.73"/>
<P unit="pascal" value="3e-18"/>
<D unit="g/cm3" value="1e-25"/>
<atom unit="g/mole" value="1.01"/>
</material>
Rationale: it reduces the amount of non-essential content in the output gdml file.
Load of saved of imported GDML file not the same as orginal import.
Load of saved of imported GDML file not the same as orginal import.
Opening of Saved FreeCAD file (FCStd ) with GDML Objects has problems
Process external XML entities before processing DOM on import
Closely related to #3 , but with external entities. This is a separate issue since it is not clear how this should be handled by the importer. It is not merely a question of substituting a value, but should the imported file be included in a single geometry tree, or does FreeCAD provide options to keep the imported file as a separate entity?
Error message upon import:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 60, in insert
processGDML(filename)
File "/usr/lib/freecad-daily/Mod/GDML/importGDML.py", line 217, in processGDML
tree = ET.parse(filename)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1659, in feed
self._raiseerror(v)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1523, in _raiseerror
raise err
<class 'xml.etree.ElementTree.ParseError'>: undefined entity &sub2;: line 23, column 3
Gist with example gdml code:
https://gist.github.com/wdconinc/64ab0fa85e2f51ff36f813d1831bc7ba
Only prompt for import | scan if running under GUI
Float values for Length
Sample file lhcbvelo.gdml has zplanes where values are sometimes given as float.
Have now coded for this i.e. zplane values can be float, but raises the issue should all other
solids that have PropertyLength be changed to PropertyFloat?
Loading large file - causes prompt for do you wish to continue
Needs investigating
Boolean operation on Linux shows isValid shape, same file on Mac Does not.
Importing from remoll geometry Mainz / detector_Mainz_v2.gdml a boolean has an invalid shape. Same file on Mac is okay. Needs further investigation i.e. check OCC versions.
Issue for discussing compound branch
Needs to be fixed to suppport running on a Mac
Add support for matrix constants
Soup of the README.md
Would you mind if I took a crack at organizing and formatting the README.md file ?
GDML Export
GDML Export on FreeCAD would be nice. Any plans for that?
GDML files from https://github.com/JeffersonLab/remoll
Trying GDML files as available at https://github.com/JeffersonLab/remoll has shown up a number of bugs. Will slowly try to tackle these. May take some time.
Restructure Import to use xml/lxml iterate rather than find
Should improve performance on large files.
Materials from remoll/geometry_Mainz/materials.xml not loading correctly
s.
Add code to deal with GDMLXtru with more than two section definitions
Add code to deal with GDMLXtru with more than two section definitions
Make changes so that can be Addon Workbench Installer
Make changes so that can be installed via the Add on Workbench Installer
OT: Macro_ObjectInfo
Hey Keith,
I had installed your WorkBench ObjectInfo (https://www.freecadweb.org/wiki/Macro_ObjectInfo) in my FreeCad for many years.
But after a reinstall I have lost now. The download-link in documentation is not working yet:
http://keithsloan.dynu.com/Keith&Jenny/FreeCAD/Info/Info.zip
Can you please send me the file info.zip in any way?
Thank you very much
lewie
Import module does not load when Gui absent
Prevents testing inside freecadcmd-daily, e.g.
import importGDML
importGDML.open("tests/import/entity1.gdml")
GDMLBox alignment after parameter change.
Needs investigating - When importing a GDML file GDMLBox solid is correctly aligned. However if the parameters for the box are changed via the normal FreeCAD change parameter facility the origin for the box is no longer correct.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.