ObjectARX

Reply
Contributor
sdphg
Posts: 25
Registered: ‎05-21-2008
Message 1 of 11 (324 Views)
Accepted Solution

how to make entity invisible but can be selected and moved?

324 Views, 10 Replies
03-23-2012 01:09 AM

I want a solution that can make entity invisible(not really),but when user select and move,the invisible entity can also be selected with other visible entities. In other words,those invisible entities are no different with visible entities but just can not be see and printed.

Any suggestions?

thanks.

Distinguished Mentor
owenwengerd
Posts: 605
Registered: ‎08-06-2002
Message 2 of 11 (314 Views)

Re: how to make entity invisible but can be selected and moved?

03-23-2012 04:00 AM in reply to: sdphg

Interactive entity selection is based on the graphical display of the entity, so there can be no interactive selection if nothing is visible.

--

Owen Wengerd

ManuSoft

 

--
Owen Wengerd
ManuSoft
Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 3 of 11 (291 Views)

Re: how to make entity invisible but can be selected and moved?

03-26-2012 12:20 AM in reply to: owenwengerd

sorry, Owen, but you are wrong :smileyhappy:

entObj->setVisibility(...) can make entity visible or invisible. it consists of parameter of the function.

 

function acedSSGet(_T("_a"), NULL, NULL, NULL, ent); will collect all enetitties regardless of their visibility :smileyhappy:

For example, make some entities invisible, and then use SELECT ALL command and move your selection. Invisible entities will be moved too.

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Distinguished Mentor
owenwengerd
Posts: 605
Registered: ‎08-06-2002
Message 4 of 11 (279 Views)

Re: how to make entity invisible but can be selected and moved?

03-26-2012 03:59 PM in reply to: Nick1983

Nick, the example you give is not interactive.

--

Owen Wengerd

ManuSoft

 

--
Owen Wengerd
ManuSoft
Valued Contributor
NikolayPoleshchuk
Posts: 60
Registered: ‎06-27-2006
Message 5 of 11 (273 Views)

Re: how to make entity invisible but can be selected and moved?

03-27-2012 12:02 AM in reply to: sdphg

In my application I use the following scheme. Before interactive selection I set hidden entities temporarily visible and highlighted to make them selectable by the user. And after selection I hide unnecessary entities again.

Nikolay Poleshchuk
http://poleshchuk.spb.ru/cad/eng.html
Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 6 of 11 (271 Views)

Re: how to make entity invisible but can be selected and moved?

03-27-2012 12:15 AM in reply to: owenwengerd

I know, but the task is "... when user select and move,the invisible entity can also be selected with other visible entities. In other words,those invisible entities are no different with visible entities but just can not be see and printed..."

So, my example shows, how can the invisible entity be colleced for moving and moved using just native acad functions and nothing more. But if it's necessary to select just several items, and move them, sdphg have to use reactors for adding invisible items to "selectionset" manually. For example, AcEditorReactor::commandWillStart() and AcEditorReactor:: commandEnded() can be used for this. For modifying preselect function acedSSSetFirst have to be used.

 

PS: Owen, the questin is "HOW TO", but not "IS IT POSSIBLE". There is a difference :smileyhappy:

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Contributor
sdphg
Posts: 25
Registered: ‎05-21-2008
Message 7 of 11 (249 Views)

Re: how to make entity invisible but can be selected and moved?

03-29-2012 03:24 AM in reply to: sdphg

Thanks you guys.

I think Nick1983 is more close to what I want.  Actually the case is: I have a rectangle and severl dbtexts inside,the text must keep inside. You can imagine the rectangle is a room and each text inside represent a furniture.In some situations some funiture(dbtext) should be hide,but when user select the room(rectangle) area then move, all of the funitures inside the room should be moved too. Or the room will lost the funitures outside the rectangle.

Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 8 of 11 (242 Views)

Re: how to make entity invisible but can be selected and moved?

03-29-2012 04:34 AM in reply to: sdphg

one of the ways to do this is to: 

1. collect your rectangle and invisible items objectids or handles (it depends on situation)

2. create a hook for entities selection

3. create AcDbDatabaseReactor and use it's objectModified() and objectOpenedForModify() functions (forget about AcEditorReactor. It'll be much harder)

 

inside the objectOpenedForModify function you can check is your rectangle preparing for transformation and collect necessary initial data (as I understand the task it can be rotated, zoomed... too). If it'll be just moved - first rectangle point will be enough.

 

inside objectModified function you have to collect the same rectangle's data and transform your texts using transformBy.

 

For more details about database reactor - ObjectARX...\samples\reactors\dbreact_dg\ 

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Valued Contributor
Nick1983
Posts: 86
Registered: ‎03-10-2010
Message 9 of 11 (236 Views)

Re: how to make entity invisible but can be selected and moved?

03-29-2012 05:30 AM in reply to: Nick1983

Forgot to say few words. Another way is to use persistent reactor. May be it'll be easier for you.

For more details - \samples\reactors\persreac_dg\

or http://through-the-interface.typepad.com/through_the_interface/2009/08/gluing-a-point-to-an-autocad-... 

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
*Expert Elite*
norman.yuan
Posts: 961
Registered: ‎04-27-2009
Message 10 of 11 (229 Views)

Re: how to make entity invisible but can be selected and moved?

03-29-2012 09:45 AM in reply to: sdphg

Using Overrule in your case may be a lot easier than using editor/database reactor.

 

For example, you can use DrawableOverrule on the rectangule, and based on theneed to draw or not draw the furniture (thus, visible/invisible). This way, there is only a single entity (rectangle), you can define some properties in the Overrule for the things conatined in the rectagle and have some methods to show/hide those things inside the rectangle.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community