Skip to content

Commit

Permalink
ellipsoid
Browse files Browse the repository at this point in the history
  • Loading branch information
KeithSloan committed May 3, 2020
1 parent 7da2b59 commit 63ab431
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 5 deletions.
126 changes: 126 additions & 0 deletions SampleFiles/Problem_Files/ORNLStomach.gdml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<gdml xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd" >
<define>
<constant name="PI" value="1.*pi" />
<constant name="TWOPI" value="2.*pi"/>
<constant name="HALFPI" value="0.5*pi"/>
<position name="OrganPos" unit="cm" x="6.90" y="-3.92" z="0" />
<rotation name="OrganRot" unit="degree" x="0" y="0" z="0" />
</define>

<materials>
<material name="sH" formula=" " Z="1.">
<D value="0.00009" />
<atom value="1.008"/>
</material>
<material name="sC" formula=" " Z="6.">
<D value="0.00226" />
<atom value="12.011"/>
</material>
<material name="sN" formula=" " Z="7.">
<D value="0.00125" />
<atom value="14.006"/>
</material>
<material name="sO" formula=" " Z="8.">
<D value="0.00143" />
<atom value="15.999"/>
</material>
<material name="sF" formula=" " Z="9.">
<D value="0.00169" />
<atom value="18.998"/>
</material>
<material name="sNa" formula=" " Z="11.">
<D value="0.00097" />
<atom value="22.989"/>
</material>
<material name="sMg" formula=" " Z="12.">
<D value="0.00174" />
<atom value="24.3"/>
</material>
<material name="sSi" formula=" " Z="14.">
<D value="0.00233" />
<atom value="28.086"/>
</material>
<material name="sP" formula=" " Z="15.">
<D value="0.00182" />
<atom value="30.973"/>
</material>
<material name="sS" formula=" " Z="16.">
<D value="0.00207" />
<atom value="32.064"/>
</material>
<material name="sCl" formula=" " Z="17.">
<D value="0.00321" />
<atom value="35.453"/>
</material>
<material name="sK" formula=" " Z="19.">
<D value="0.00086" />
<atom value="39.10"/>
</material>
<material name="sCa" formula=" " Z="20.">
<D value="0.00155" />
<atom value="40.08"/>
</material>
<material name="sFe" formula=" " Z="26.">
<D value="0.00786" />
<atom value="55.847"/>
</material>
<material name="sZn" formula=" " Z="30.">
<D value="0.00714" />
<atom value="65.37"/>
</material>
<material name="sRb" formula=" " Z="37.">
<D value="0.00153" />
<atom value="85.47"/>
</material>
<material name="sSr" formula=" " Z="38.">
<D value="0.00260" />
<atom value="87.62"/>
</material>
<material name="sZr" formula=" " Z="40.">
<D value="0.00649" />
<atom value="91.22"/>
</material>
<material name="sPb" formula=" " Z="82.">
<D value="0.01140" />
<atom value="207.19"/>
</material>

<material formula=" " name="SoftTissue">
<D value="1.04" />
<fraction n="0.10454" ref="sH" />
<fraction n="0.22663" ref="sC" />
<fraction n="0.02490" ref="sN" />
<fraction n="0.63525" ref="sO" />
<fraction n="0.00112" ref="sNa" />
<fraction n="0.00013" ref="sMg" />
<fraction n="0.00030" ref="sSi" />
<fraction n="0.00134" ref="sP" />
<fraction n="0.00204" ref="sS" />
<fraction n="0.00133" ref="sCl" />
<fraction n="0.00208" ref="sK" />
<fraction n="0.00024" ref="sCa" />
<fraction n="0.00005" ref="sFe" />
<fraction n="0.00003" ref="sZn" />
<fraction n="0.00001" ref="sRb" />
<fraction n="0.00001" ref="sZr" />
</material>

</materials>

<solids>

<ellipsoid aunit="cm" lunit="cm" name="Stomach" ax="3.43" by="2.92" cz="7.16" zcut1="-7.16" zcut2="7.16" />

</solids>

<structure>
<volume name="StomachVolume" >
<materialref ref="SoftTissue" />
<solidref ref="Stomach" />
</volume>
</structure>
<setup name="Default" version="1.0" >
<world ref="StomachVolume" />
</setup>
</gdml>
10 changes: 5 additions & 5 deletions freecad/gdml/GDMLObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,15 @@ def createGeometry(self,fp):
mat = FreeCAD.Matrix()
mat.unity()
# Semi axis values so need to double
mat.A11 = ax / 100
mat.A22 = by / 100
mat.A33 = cz / 100
mat.A11 = ax / 50
mat.A22 = by / 50
mat.A33 = cz / 50
mat.A44 = 1
zcut1 = abs(fp.zcut1*mul)
zcut2 = abs(fp.zcut2*mul)
GDMLShared.trace("zcut2 : "+str(zcut2))
t1ellipsoid = sphere.transformGeometry(mat)
if zcut2 != None and zcut2 > 0 : # Remove from upper z
if zcut2 != None and zcut2 > 0 and zcut2 < cz: # Remove from upper z
box1 = Part.makeBox(2*ax,2*by,zcut2)
pl = FreeCAD.Placement()
# Only need to move to semi axis
Expand All @@ -493,7 +493,7 @@ def createGeometry(self,fp):
t2ellipsoid = t1ellipsoid.cut(box1)
else :
t2ellipsoid = t1ellipsoid
if zcut1 != None and zcut1 > 0 :
if zcut1 != None and zcut1 > 0 and zcut1 < cz:
# Remove from lower z, seems to be a negative number
box2 = Part.makeBox(2*ax,2*by,zcut1)
pl = FreeCAD.Placement()
Expand Down

0 comments on commit 63ab431

Please sign in to comment.