Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can we get the segment type from Polyline2d and Polyline3d using C# ?

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
876 Views, 2 Replies

Can we get the segment type from Polyline2d and Polyline3d using C# ?

In Polyline, we have the GetSegmentType:

 

public static void GetPolylineSegment(Polyline pline){
Point3d p3d;
SegmentType stype;    int vn = pline.NumberOfVertices;    for (int i = 0; i < vn; i++){       p3d = pline.GetPoint3dAt(i);
segmentType = pline.GetSegmentType((int)pline.GetParameterAtPoint(p3d));
if (segmentType == SegmentType.Arc) {
// find an arc segment
}
else if (segmentType == SegmentType.Line) {
// find a line segment
}
// ...    } }

 

Polyline2d and Polyline3d doesn't have the same method, so is there a workaround to deal with ?

2 REPLIES 2
Message 2 of 3
pendean
in reply to: Anonymous

You need to post in the proper customization forum: http://forums.autodesk.com/t5/autocad-customization/ct-p/AutoCADTopic1
Message 3 of 3
Kent1Cooper
in reply to: Anonymous

The Customization Forum would be better, but in the meantime....

 

If I understand what you're asking, one thing you can do [I know how to do it in AutoLISP, but I couldn't say whether it can be done in that programming language], that works on either lightweight or heavy Polylines, is to apply Object Snap CENTER at the pick point.  If it returns anything, you've picked on an arc segment, otherwise on a line segment.  Temporarily set the APERTURE System Variable to be the same size as the PICKBOX, to avoid the possibility of catching some other nearby thing that happens to have a Center.

 

But I would point out that there's no need to make a determination for segment type on 3DPolylines, which can't have arc segments [unless, of course, you don't know what kind of object you're picking on when you pick it, in which case the above approach will appropriately determine for a 3DPolyline that you picked on a line segment].

Kent Cooper, AIA

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report