How do I go about extruding an open polyline to create a surface ? I am able to extrude a solid 3d from a closed polyline ( by creating a region first) but I cant find a way to do the same for surfaces.The autodesk.autocad.databaseservices.Surface class does not have an extrude method unlike the its solid3d equivalent. I am using autocad 2012 .
Thank you
Solved! Go to Solution.
Solved by insiaiftiqhar. Go to Solution.
If anyone is interested ,this is how is implemented it..
Polyline pPoly = pEntity as Polyline; Autodesk.AutoCAD.DatabaseServices.ExtrudedSurface extrSurf = new Autodesk.AutoCAD.DatabaseServices.ExtrudedSurface(); Autodesk.AutoCAD.DatabaseServices.Face face = new Autodesk.AutoCAD.DatabaseServices.Face( pPoly.StartPoint,pPoly.EndPoint,pPoly.EndPoint + new Vector3d(0, 0, 1000), pPoly.StartPoint + new Vector3d(0, 0, 1000), true, true, true, true); Autodesk.AutoCAD.DatabaseServices.Surface sweepEnt = new Autodesk.AutoCAD.DatabaseServices.Surface(); sweepEnt.SetDatabaseDefaults(); try { sweepEnt = Autodesk.AutoCAD.DatabaseServices.Surface.CreateFrom(face); } catch (Autodesk.AutoCAD.Runtime.Exception e) { } SweepOptions sweepOpts = new SweepOptions(); try { extrSurf.CreateExtrudedSurface(sweepEnt, (pPoly.EndPoint - pPoly.StartPoint).GetPerpendicularVector(), sweepOpts); } catch { ed.WriteMessage( "\nFailed with CreateExtrudedSurface." ); }
Hello insiaiftiqhar:
thanks for sharing, but what if the polyline is not on the same line?
Jerry form China!
Why not add some directives to make your code easier to read?
e.g.
using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices;