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

how can i get the boundary entity from a pick point?

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
1568 Views, 9 Replies

how can i get the boundary entity from a pick point?

how can i get the boundary entity from a pick point?

Can any one help me! Cat Frustrated

9 REPLIES 9
Message 2 of 10
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

if your boundaries are closed polylines then this could be one approach:

  • fire a ray from your picked point to any direction
  • get the intersecionpoints with all possible boundaries around
  • sort the intersectionpoints by distance between original point and intersection point
  • for each of the sorted points (nearest first)
  •    check if the point is inside the polygon (that the ray intersected at this point)
  •    if so
  •        it's your boundary

 

Good lock, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 10
Anonymous
in reply to: Alfred.NESWADBA

ads_point pt;
ads_name plBndry;
if( acedGetPoint(NULL, _T("Pick a point inside a closed area:"), pt) != RTNORM )  return;
acedCommand(RTSTR, _T("-BOUNDARY"), RTSTR, _T("AD"), RTSTR,_T("IS"), RTSTR,_T("Y"),RTSTR,_T("OB"),RTSTR,_T("PO"),RTSTR,_T(""), RTPOINT, pt, RTSTR, _T(""), RTNONE);
acdbEntLast(plBndry); // here is your boundary.

sample doesn't control boundary creation. so,  you have to use acdbEntLast before this code too. and then compare two last entities (before and after boundary creation). if they are different - code created boundary.


Message 4 of 10
Alexander.Rivilis
in reply to: Anonymous

ObjectARX SDK since version 2011 provide acedTraceBoundary function which can help you. Read carefully its description in the ObjectARX documentation.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 5 of 10

Hi Alexander,

 

>> ObjectARX SDK since version 2011 provide acedTraceBoundary function which can help you

Have you already played with that function?

IMHO it has the same problem as the default _BOUNDARY-command, sometimes it does not see objects as they are out of display-list-active area. Did you get better/other results?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 6 of 10
Anonymous
in reply to: Alfred.NESWADBA

hi, alfred.

acedCommand ( RTSTR, _T("_zoom"),  RTSTR, _T("_e"),RTNONE ); // before command
acedCommand ( RTSTR, _T("_zoom"), RTSTR, _T("_p"),RTNONE); // after command

will help to fix it. it's an only way

Message 7 of 10


@Alfred.NESWADBA wrote:

Hi Alexander,

 

>> ObjectARX SDK since version 2011 provide acedTraceBoundary function which can help you

Have you already played with that function?

IMHO it has the same problem as the default _BOUNDARY-command, sometimes it does not see objects as they are out of display-list-active area. Did you get better/other results?

 

- alfred -


Smiley Happy That is why I wrote to read documentation carefully:

To succeed, the entities that form the boundary to be found must be entirely visible on screen in the AutoCAD editor.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 8 of 10
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

thanks to both of you, however using such algorithms depending the visibility on screen + depending the size of the object on the screen + depending the zoom-factor + + + ....makes me ill when I do develop anything like GIS searching not just one boundary but thousands.

Additionally the command _BOUNDARY sometimes does not work

  • even if the objects are full visible on screen it can't find a boundary
  • in some cases it does NOT follow the geometry exactly (sample attached, do ZOOM EXTENTS, then _BOUNDARY and after that look to the top-right corner, the peak is lost in the "boundary" 😞 ).

So SendCommand (whatever internal method is used) does not work correct in all cases, if the ARX-functionality is equal to the command, then at least be very careful using that!

For me the conclusion is: don't use that as it does not work well.

 

- alfred -

 

BTW: for Autodesk, that bug (described in b)) I reported for AutoCAD 2004 I think. With 2013 it's still there 😞

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 9 of 10
Anonymous
in reply to: Alfred.NESWADBA

in some cases it does NOT follow the geometry exactly

Alfred, it doesn't follow at all for splines and sometimes doesn't follow for arc segments.

In my case I don't have such problems, because I know all object's type, that will be used for boundary command, and I can create a simplified variant for them (just linear segments) just for this command.

 

don't use that as it does not work well

There are no other variants. So, if it doesn't work well, force it :):):) To write it manually is much harder than to force raw variant to work correctly.

 

that bug (described in b)) I reported for AutoCAD 2004 I think. With 2013 it's still there

it's not a bug. it's an "expected behavior":). they have no time to fix it 🙂 android and kinect are autocad's future  Smiley LOL Smiley LOL Smiley LOL

 

 

Message 10 of 10
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

>> To write it manually is much harder than to force raw variant to work correctly.

But as long as you need your program working, it's a must (and it's done already 😉 but not using acedTraceBoundary as this part was written in 2007 or so)

 

>> it's not a bug. it's an "expected behavior"

🙂

 

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)

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

Post to forums  

Autodesk Design & Make Report

”Boost