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.
Solved! Go to Solution.
Interactive entity selection is based on the graphical display of the entity, so there can be no interactive selection if nothing is visible.
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.
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.
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
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.
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\
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\
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.
Start with some of our most frequented solutions to get help installing your software.