In the process of creating a demo for a IFC Database PoC I saw that in my previous treatment of curved pipe segments using tesselation causes a huge blowup in the generated IFC file size. So I started to add support for IfcRevolvedAreaSolid
to reduce IFC file size.
That's when I encountered an issue with constructing the revolve operation of out-of-plane shapes.
To give a minium example to test that the revolved solids are calculated properly I create a simple pipe using a list of coordinates that results in a few segments with bends that occur in-plane
and out-of-plane
.
Here is the gist of inputs needed to generate the 3d model.
from ada import Section, Pipe
from ada.config import Settings
coords = [(0, -0.2, 3.2), (5.2, -0.2, 3.2), (5.2, 4.8, 3.2), (10, 4.8, 5.2), (10, 4.8, 13.2)]
pipe1 = Pipe("Pipe1", coords, Section("PSec", "PIPE", r=0.10, wt=5e-3))
a = Assembly("MyTest") / (Part("MyPart") / pipe1
Settings.make_param_elbows = True
a.to_ifc("pipe_bend_multiple.ifc")
adapy
will automatically calculate and define a "bend radius" of "r = 0.196" between the segments and use basic geometry
to find where the straight segments should end and where the curve should start.
When exporting this pipe to STEP using pythonocc-core (and letting OpenCascade handle the extrusion):
However, when I export to IFC I end up with:
As observed in the IFC file, the revolved shape located in the XY
plane works as expected. However, the other 2 shapes that are to be revolved in an out-of-plane manner fails.
FYI: Here is the ifc file
pipe_bend_multiple.zip (zipped IFC file)
For the portion of the pipe that works as intended (in the XY
plane) the IFC input looks like this.
/* IfcRevolvedAreaSolid "Pipe1_2_Elbow" Actually displaying correctly */
#94=IFCDIRECTION((-1.,0.,4.26642158858964E-17));
#95=IFCCARTESIANPOINT((0.,0.195958125,0.));
#96=IFCAXIS1PLACEMENT(#95,#94);
#97=IFCDIRECTION((1.,0.,0.));
#98=IFCDIRECTION((0.,0.,-1.));
#99=IFCCARTESIANPOINT((5.004041875,-0.2,3.2));
#100=IFCAXIS2PLACEMENT3D(#99,#97,#98);
#101=IFCREVOLVEDAREASOLID(#70,#100,#96,90.);
#102=IFCSHAPEREPRESENTATION(#11,'Body','SweptSolid',(#101));
#103=IFCPRODUCTDEFINITIONSHAPE($,$,(#102));
#104=IFCDIRECTION((0.,0.,1.));
#105=IFCDIRECTION((1.,0.,0.));
#106=IFCCARTESIANPOINT((0.,0.,0.));
#107=IFCAXIS2PLACEMENT3D(#106,#104,#105);
#108=IFCLOCALPLACEMENT($,#107);
#109=IFCPIPEFITTING('2K$U6nEOWHxPuP01fzsd4G',#25,'Pipe1_2_Elbow','An awesome Elbow',$,#108,#103,$,$);
/* END of IfcRevolvedAreaSolid "Pipe1_2_Elbow" Actually displaying correctly */
And here is the IFC description for one of the 2 failing shapes "Pipe1_4_Elbow":
/* IfcRevolvedAreaSolid "Pipe1_4_Elbow" not displaying correctly */
#141=IFCDIRECTION((0.14792899408284,0.923076923076923,-0.355029585798817));
#142=IFCCARTESIANPOINT((0.180884423076923,0.,0.0753685096153847));
#143=IFCAXIS1PLACEMENT(#142,#141);
#144=IFCDIRECTION((0.,1.,0.));
#145=IFCDIRECTION((-0.384615384615385,0.,0.923076923076923));
#146=IFCCARTESIANPOINT((5.2,4.604041875,3.2));
#147=IFCAXIS2PLACEMENT3D(#146,#144,#145);
#148=IFCREVOLVEDAREASOLID(#70,#147,#143,90.);
#149=IFCSHAPEREPRESENTATION(#11,'Body','SweptSolid',(#148));
#150=IFCPRODUCTDEFINITIONSHAPE($,$,(#149));
#151=IFCDIRECTION((0.,0.,1.));
#152=IFCDIRECTION((1.,0.,0.));
#153=IFCCARTESIANPOINT((0.,0.,0.));
#154=IFCAXIS2PLACEMENT3D(#153,#151,#152);
#155=IFCLOCALPLACEMENT($,#154);
#156=IFCPIPEFITTING('2L02kiEOWHxPWc01fzsd4G',#25,'Pipe1_4_Elbow','An awesome Elbow',$,#155,#150,$,$);
/* END of IfcRevolvedAreaSolid "Pipe1_4_Elbow" not displaying correctly */
Obviously there is a bug in what I insert into the IFCREVOLVEDAREASOLID
IFC object.
The failing revolved shape should start and stop at points A
& B
,
while 2 vectors of the two straight segments are A_V
and B_V
.
A=(5.2,4.604041875,3.2)
B=(5.38088442, 4.8, 3.27536851)
A_V=(0., 1., 0.)
B_V=(0.92307692, 0., 0.38461538)
Here is the current code where I use IfcOpenShell to write the IFC objects: https://github.com/Krande/adapy/blob/pipeelbow/src/ada/ifc/write/write_pipe.py#L242-L286
Here are some things I might be misunderstanding from the IFC4_3 docs:
- Should the rotation axis
IfcAxis1Placement
be defined relative to the coordinate system of the IfcAxis2Placement3D
?
@aothms: I'm sorry to bug you with this. But if you have a spare moment to see if you notice what I'm doing wrong with IfcRevolvedAreaSolid
it would definitively help (as I seem to be going in circles :) )