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

How to locate the lines and arcs in a polyline

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
mecoman6GF27
499 Views, 4 Replies

How to locate the lines and arcs in a polyline

Hello to all.

I would like to ask you this question: by selecting a polyline is it possible to identify the number of lines and the number of arcs and their positions?

I post an image to explain myself better.

Imege.jpg

 

Thanks a lot, bye.

4 REPLIES 4
Message 2 of 5
_gile
in reply to: mecoman6GF27

Hi,

 

The Polyline class provides a property to get the number of vertices (NumberOfVertices) and methods to get a point at index (GetPoint2dAt and GetPoint3dAt) and to get the segment type at index (GetSegmentType).

 

Here's a snippet example:

for (int i = 0; i < pline.NumberOfVertices; i++)
{
    ed.WriteMessage($"\n{pline.GetPoint2dAt(i):0.00} = {pline.GetSegmentType(i)}");
}


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5
mecoman6GF27
in reply to: _gile

Hello.
I asked myself a question: how can I know the total number of segments of the polyline made up of lines and arcs?

Bye.

Message 4 of 5
_gile
in reply to: mecoman6GF27

Starting with the upper example, you should be able to do it by yourself.

Initialize two counters (e.g. lineCount and arcCount) at 0, and in the for loop increment them according to the value returned by:

pline.GetSegmentType(i)

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 5
mecoman6GF27
in reply to: _gile

Thanks for your help. Bye

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report