Hi!
Thanks, @jonm, @dale and @menno for your fast reply.
I’ve already done this. But the problem is not about capping the extrusion but defining a consistent group of extrusions from a group of closed and planar curves.
The history about this curves is long but easy they are just fractions of planar circular crowns around a shared axis (not center) that are the basic layout for some mad architecture proposal.
The planar arcs generated to build that circular crowns segments are created parametrically and all of them have the same radious. Them I copy them into a new variable with “copy.Copy(object)” and modify the radius with the desired width for the circular crown. Just a snippet (it is in a class context):
c = self.crvBase
offCrv = copy.copy(c)
offCrv.Radius += self.width
Adding some lines to connect both arcs and joining averything together I obtain the desired crown:
l1 = rg.Line(c.StartPoint, offCrv.StartPoint)
l2 = rg.Line(c.EndPoint, offCrv.EndPoint)
planCrv = rg.Curve.JoinCurves((c.ToNurbsCurve(),l1.ToNurbsCurve(),l2.ToNurbsCurve(),offCrv.ToNurbsCurve()))[0]
The problem is that those curves are not equally oriented. and that is a pain in the ass to get the rg.Extrusion.Create() method working. Indeed, I try to orient them checking the Z axis of the plane extracted from everyone. Another snippet:
> plane = planCrv.TryGetPlane()[0]
> if plane.ZAxis[2] != 1:
> planCrv.Reverse()
But something strange happens. It works partially; if I try to change the radius of the initial arcs, at certain value, some curves flipped and this small snippet doesn’t affect them…
The thing is that getting some sleep I found a solution that doesn’t include to use rg.Surface.CreateExtrusion + rg.Brep.CreateFromSurface + rg.Brep.CapPlanarHoles and consequently needing to deal with a Brep (I’m searching an extrusion). What I though? Just use the las snippet check and use it to multiply the extrusion height in rg.Extrusion.Create() by “-1”. Snippet:
plane = planCrv.TryGetPlane()[0]
if plane.ZAxis[2] != 1:
extrusionHeight *= -1
vol = rg.Extrusion.Create(planCrv,extrusionHeight,True)
The collateral damage is clear, I’m leaving behind some poorly oriented curves that probably I will need to deal with sooner or later creating the FEM model or some basic 3d elements for the rendering model.
I hope to be clear enough in my explanation. My English is a little bit rusty and this is quite a long post.
Thanks in advance.