Author Topic: How does _isolateobjects work?  (Read 274 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 605
How does _isolateobjects work?
« on: November 01, 2019, 04:26:15 AM »
Hi

I have a code that i can use to turn objects on/off.
This is exactly the same as the "_isolateobjects" "_unisolateobjects" in the status bar.
However, what i miss in default AutoCAD is the functionality to INVERSE the selection, that is why i use the code beneith.

Problem i have is that this function is much slower and the two are not compatible.
I would like to rewrite the code so that it makes use of the same 'technology'. Any have a clue how do do this?

This video demonstrates the difference and the missing of the "INVERSE" function (c:rew)


https://youtu.be/F3nFcd5K2KQ

Thanks


Code: [Select]


; ISOS
; ISOS => ISOLATE SELECTED

(defun C:isos ( / SSL SSX )
(vl-load-com)
 
(setq acadobject (vlax-get-Acad-Object))
(setq acdoc (vla-get-activedocument acadobject))
(if
(and
(princ "\nSelect objects to isolate: ")
(setq SSL (ssget "_:L"))
(setq SSX (ssget "_X" ))
);and
(progn
(PutEverythingInvisible SSX)
(PutEverythingVisible SSL)
(vla-Regen acdoc :vlax-true)
);progn
 
  )

   ;(greybground)
 
  (princ)
);defun



; OZBS
; OZBS => TURN ON

(defun C:ozbs ( / SSL )
(vl-load-com)
(setq acadobject (vlax-get-Acad-Object))
(setq acdoc (vla-get-activedocument acadobject))

  (if
(and
(princ "\nSelect objects to hide: ")
(setq SSL (ssget "_:L"))
);and
(progn
(PutEverythingInvisible SSL)
(vla-Regen acdoc :vlax-true)
);progn
)
(princ)
);defun

; ZB
; ZB => TURN ON

(defun C:zb ( / SSL SSX )
(vl-load-com)



  (setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object)))) ; zwarte display
  (vla-put-GraphicsWinModelBackgrndColor disp 0) ; zwarte display
 
(setq acadobject (vlax-get-Acad-Object))
(setq acdoc (vla-get-activedocument acadobject))
(if
(and
(princ "\nSetting everything to visible! ")
(setq SSX (ssget "_X" ))
);and
(progn
(PutEverythingVisible SSX)
(vla-Regen acdoc :vlax-true)
);progn
)
 
 
(princ)
);defun

; REW
; REW => INVERSE VISIBLE / INVISIBLE 

(defun C:rew ( / SSL SSX ) ; inverse function
 
(vl-load-com) 
(setq acadobject (vlax-get-Acad-Object))
(setq acdoc (vla-get-activedocument acadobject))
(if
(and
(princ "\nInversing the visibility! ")
(setq SSX (ssget "_X" ))
);and
(progn
(ReverseVisibility SSX)
(vla-Regen acdoc :vlax-true)
);progn
)

    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))

(princ)
   
) ;defun


(defun PutEverythingInvisible ( SS / ent enx vla-obj )
(repeat (setq i (sslength SS))
(setq ent (ssname SS (setq i (1- i))))
(setq enx (entget ent))
(setq vla-obj (vlax-ename->vla-object ent))

(if
(and (vlax-property-available-p vla-obj "Visible") (= (vlax-get-property vla-obj 'Visible) :vlax-true))
(vla-put-Visible vla-obj :vlax-false)
)
)
)

(defun PutEverythingVisible ( SS / ent enx vla-obj )
(repeat (setq i (sslength SS))
(setq ent (ssname SS (setq i (1- i))))
(setq enx (entget ent))
(setq vla-obj (vlax-ename->vla-object ent))

(if
(and (vlax-property-available-p vla-obj "Visible") (= (vlax-get-property vla-obj 'Visible) :vlax-false))
(vla-put-Visible vla-obj :vlax-true)
)
)
)

(defun ReverseVisibility ( SS / ent enx vla-obj )
(repeat (setq i (sslength SS))
(setq ent (ssname SS (setq i (1- i))))
(setq enx (entget ent))
(setq vla-obj (vlax-ename->vla-object ent))

(cond
((and (vlax-property-available-p vla-obj "Visible") (= (vlax-get-property vla-obj 'Visible) :vlax-false))
(vla-put-Visible vla-obj :vlax-true)
)
((and (vlax-property-available-p vla-obj "Visible") (= (vlax-get-property vla-obj 'Visible) :vlax-true))
(vla-put-Visible vla-obj :vlax-false)
)
)
)
)

Design is something you should do with both hands. My 2d hand , my 3d hand ..

Peter2

  • Swamp Rat
  • Posts: 564
Re: How does _isolateobjects work?
« Reply #1 on: November 01, 2019, 01:06:32 PM »
Aside from your code - do you know the functions "dos_hideobjects / dos_showobjects" from Doslib?

https://github.com/dalefugier/DOSLib/wiki/dos_hideobjects

---
Peter

AutoCAD Map 3D 2018 German (so some technical terms will be badly retranslated to English)
BricsCAD V19

lamarn

  • Swamp Rat
  • Posts: 605
Re: How does _isolateobjects work?
« Reply #2 on: November 05, 2019, 05:17:15 PM »
Thanks Peter,
The doslib method seems to work just like the lisp routine.
However, this tool also doen not trigger 'unhide object visibility' from the traybar.
I think i found something here.

https://forums.autodesk.com/t5/objectarx/how-to-isolate-hide-objects-like-command-isolateobjects/td-p/4750027

Because it is API code based ARX it has some connection with traybar icons, this cannot be done using lisp (right?)
Maybe a good idea for a OpenDCL approach.
Does DOSlib have a method to isolate objects and a method to inverse the hidden / displayed objects?
« Last Edit: November 05, 2019, 05:25:52 PM by lamarn »
Design is something you should do with both hands. My 2d hand , my 3d hand ..

huiz

  • Swamp Rat
  • Posts: 843
  • Certified Prof C3D
Re: How does _isolateobjects work?
« Reply #3 on: November 06, 2019, 03:08:51 AM »
AutoCAD saves a dictionary in the NOD where it references to the affected objects.


So the function in the toolbar just reacts on the referenced objects in the dictionary, not on invisible objects.


You can alter the dictionary yourself via Lisp, if you know how that works. It is not said that it will trigger the icon. Another option is to use the commands 'isolateobjects' and 'unisolateobjects' in your lisp.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

huiz

  • Swamp Rat
  • Posts: 843
  • Certified Prof C3D
Re: How does _isolateobjects work?
« Reply #4 on: November 06, 2019, 03:09:45 AM »
This is where AutoCAD saves the values.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

lamarn

  • Swamp Rat
  • Posts: 605
Re: How does _isolateobjects work?
« Reply #5 on: November 06, 2019, 01:31:15 PM »
Dank je! Thanks!
Is there a way so i tell Acad that it should unisolate isolated and isolate unisolated (so a reverse display) using these standard methods???
Design is something you should do with both hands. My 2d hand , my 3d hand ..

huiz

  • Swamp Rat
  • Posts: 843
  • Certified Prof C3D
Re: How does _isolateobjects work?
« Reply #6 on: November 07, 2019, 03:30:54 AM »
I'm not a lisper, but a C# programmer.


It's hard to understand how it works. In the dictionary there is a result buffer with 2 values. 0/-1 if an object is isolated, 2/-1 if an object is hided. But with some tests, the latter combination is different every time.
Further the dictionary has hard pointers to a DBDictionary which references to new dictionaries and Xrecords. But I can't find references to the ObjectId's of the hidden or isolated objects.


I still think the best way is to use the commands in your lisp.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.