how to get all vertexs of an entity

how to get all vertexs of an entity

18627796338
Enthusiast Enthusiast
1,560 Views
9 Replies
Message 1 of 10

how to get all vertexs of an entity

18627796338
Enthusiast
Enthusiast

Hello, everyone!

Now I'm developing a plug-in for comparison viewsheets by C#. So I need to get all points of the entity to know if it has been edited. I can get all the entities in both viewsheets, but I coundn't find any attributes describe all points in the entity.

Please help me. Thank you very much!

0 Likes
Accepted solutions (1)
1,561 Views
9 Replies
Replies (9)
Message 2 of 10

_Tharwat
Advisor
Advisor

Hi,

 

What is the name of that object name you are talking about?

0 Likes
Message 3 of 10

18627796338
Enthusiast
Enthusiast

I'm not sure what do you mean by name. Type name?

The entities belong to different types, for example: Polyline, Line, Ellipse, Arc ...etc.

Their whole type name is like Autodesk.AutoCAD.DatabaseServices.Polyline.

0 Likes
Message 4 of 10

_Tharwat
Advisor
Advisor

So which entity you want to get its vertices ? Line, Polyline ... etc.

0 Likes
Message 5 of 10

18627796338
Enthusiast
Enthusiast

I need to get all. The different types have different methods to get vertices?

0 Likes
Message 6 of 10

_Tharwat
Advisor
Advisor
Accepted solution

I am not sure that you can get vertices of all curve entity types with one method but if you want to see how to retrieve points for a Polyline , here is an example: This Link

Message 7 of 10

18627796338
Enthusiast
Enthusiast

Thank you very much!

It works.

But there is still a problem, I think the problem is related to the follow code:

int pts = (int)pl.GetParameterAtPoint(pl.EndPoint);

In fact, the value of param pts is 0. pts should be the number of how many points the polyline have. Do you know some other methods to get the number?

0 Likes
Message 8 of 10

_Tharwat
Advisor
Advisor

18627796338 wrote:

Thank you very much!

It works.

But there is still a problem, I think the problem is related to the follow code:

int pts = (int)pl.GetParameterAtPoint(pl.EndPoint);

In fact, the value of param pts is 0. pts should be the number of how many points the polyline have. Do you know some other methods to get the number?

It should not be equal to zero though it works here as expected, anyway try to convert it as following instead:
int pts = Convert.ToInt32(pl.GetParameterAtPoint(pl.EndPoint));

 

 

0 Likes
Message 9 of 10

18627796338
Enthusiast
Enthusiast
Thank you 😄
I don't know why it is still 0. But I find another attribute pl.NumberOfVertices. So my problem solved.
Message 10 of 10

_Tharwat
Advisor
Advisor

@18627796338 wrote:
Thank you 😄
I don't know why it is still 0. But I find another attribute pl.NumberOfVertices. So my problem solved.

Yes that is another good solution to get the number of vertices. thanks for lighting on it.

0 Likes