.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

extruding an open polyline to create a surface

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
insiaiftiqhar
1828 Views, 3 Replies

extruding an open polyline to create a surface

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

3 REPLIES 3
Message 2 of 4

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

                            );

                        }

 

Message 3 of 4
1368026189
in reply to: insiaiftiqhar

Hello insiaiftiqhar:

thanks for sharing, but what if the polyline is not on the same line?

Jerry form China!

Message 4 of 4
BKSpurgeon
in reply to: insiaiftiqhar

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;

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost