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/F3nFcd5K2KQThanks
; 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)
)
)
)
)