.NET

.NET

Reply
Contributor
insiaiftiqhar
Posts: 19
Registered: ‎06-21-2012
Message 1 of 2 (596 Views)
Accepted Solution

extruding an open polyline to create a surface

596 Views, 1 Replies
05-16-2013 04:04 PM

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

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."
);
}

 

Contributor
insiaiftiqhar
Posts: 19
Registered: ‎06-21-2012
Message 2 of 2 (556 Views)

Re: extruding an open polyline to create a surface

05-20-2013 02:35 PM in reply to: insiaiftiqhar

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."

                            );

                        }

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.