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

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

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
sdphg
1143 Views, 10 Replies

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

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.

10 REPLIES 10
Message 2 of 11
owenwengerd
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
Message 3 of 11
Nick1983
in reply to: owenwengerd

sorry, Owen, but you are wrong 🙂

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 🙂

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
Message 4 of 11
owenwengerd
in reply to: Nick1983

Nick, the example you give is not interactive.

--

Owen Wengerd

ManuSoft

 

--
Owen Wengerd
ManuSoft
Message 5 of 11
NikolayPoleshchuk
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
Message 6 of 11
Nick1983
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 🙂

---
#define QUESTION(b) (2*b)||(!(2*b)) © William Shakespeare
Message 7 of 11
sdphg
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.

Message 8 of 11
Nick1983
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
Message 9 of 11
Nick1983
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
Message 10 of 11
norman.yuan
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.

 

Message 11 of 11
sdphg
in reply to: sdphg

Thank you Nick.Looks there is no straightfoward way. so your solution is the best.

norman.yuan thank you too. Your suggestion is very well,but I am not familiar with Overrule and it looks the Overrule is not support in AutoCAD2007,is this right?Is the Overrule in .net equals to custom entity in c++?I think custom entity is another way to achieve my aim.

Thank you everybody!

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

Post to forums  

Autodesk Design & Make Report

”Boost