How to get the Object Points by Javascript

How to get the Object Points by Javascript

Anonymous
Not applicable
1,180 Views
5 Replies
Message 1 of 6

How to get the Object Points by Javascript

Anonymous
Not applicable

Hi,

 

   I'm developing a javascript where once an Entity is selected (in my case, a Polyline), be able to get the vertex.

 

   My App need to get for each Polyline selected, every 2D point in the shape and store such points in my DB.

 

   Once I have the Entity selected and got it's ID, what function would hep me?

 

   Is there any way to accomplish this task?

 

   

0 Likes
1,181 Views
5 Replies
Replies (5)
Message 2 of 6

_Tharwat
Advisor
Advisor

Hi,

 

Firstly I hope I got your point and secondly I hope you able to read C# codes to get the idea of the program and transfer them into Java.

 

Have a look;

 

var pl = (Polyline)trA.GetObject(s.ObjectId, OpenMode.ForRead);
Point3dCollection lst = new Point3dCollection();
int pts = (int)pl.GetParameterAtPoint(pl.EndPoint);
ed.WriteMessage("\nNumber of params : " + (pts + 1).ToString());
for (int i = 0; i < (pts + 1); i++)
{
lst.Add(pl.GetPointAtParameter(i));
}
foreach (Point3d p in lst)
{
ed.WriteMessage("\nPoint :" + p.ToString());

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi @_Tharwat,

 

  Thanks for your quick answer.

 

  Your solution step by creating a new DLL in .NET based on C# and within javascript call such function to be able to catch the points from the selected Entity?

0 Likes
Message 4 of 6

kerry_w_brown
Advisor
Advisor

What does 

Acad.DBEntity.getProperties();

do for you ?? 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 5 of 6

_Tharwat
Advisor
Advisor

@Anonymous wrote:

Hi @_Tharwat,

 

  Thanks for your quick answer.

 

  Your solution step by creating a new DLL in .NET based on C# and within javascript call such function to be able to catch the points from the selected Entity?


Sorry I did not get your point and question.

Clarify it a bit more.

0 Likes
Message 6 of 6

Keith.Brown
Advisor
Advisor
I believe he meant that your solution was to solve the problem in .NET and then call your solution from JavaScript.

I don't believe this is what you meant. I think you meant the original poster to look at your solution and translate it to JavaScript.
0 Likes