TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Bred on July 13, 2007, 03:38:23 AM
-
Hello everybody,
for 2008.
When I makes :
(vla-put-Lock (vlax-ename->vla-object (tblobjname "LAYER" "Layer")) :vlax-True)
The layer is locked… but the objects does not attenuate… (LAYLOCKFADECTL at 50)
(command "_-layer" "_lock" "Layer" "" "")
it's good... but :-(
an idea?
thank you
-
Check out THIS (http://www.theswamp.org/index.php?topic=15677.msg190781#msg190781) post.
Oh, and welcome to theSwamp!
-
Thanks!
But:
(setq fadeSet(vla-getvariable activeDoc "LAYLOCKFADECTL"))
(vla-setvariable activeDoc "LAYLOCKFADECTL" 0)
(vla-setvariable activeDoc "LAYLOCKFADECTL" fadeSet)
for locked : OK
for unlocked : No.... :|
-
Heh, you are absolutely correct! Now why didn't anyone else catch that? Let me see what I can find out.
-
Hello, then : :?
(vla-Regen (vla-get-activedocument (vlax-get-acad-object)) acActiveViewport)
it's good... but very heavy... :|
and
(repeat (setq x (sslength (setq sel (ssget "_X" (list (cons 8 "my_layer"))))))
(vla-update (vlax-ename->vla-object (ssname sel (setq x (1- x)))))
)
it's good... except "error layer locked" .... :x
-
Hi Bred,
The answer I got from the higher ups is:
Another suggestion for this behavior is to manipulate a “Layer state”. You don’t have do this manipulation for each and every layer you manipulate, but only when once you have finished with locking/unlocking your required layers.
So here's lisp code that does this:
;;test the lock/unlock display for "Layer1"
(defun c:locktest (/ lays *acad doc lstates)
(vl-load-com)
(setq *acad (vlax-get-acad-object)
doc (vla-get-activedocument *acad)
lay (vla-item (vla-get-layers doc) "Layer1"))
(if (= :vlax-true (vla-get-lock lay))
(vla-put-lock lay :vlax-false)
(vla-put-lock lay :vlax-true)
)
(setq lstates (vla-getinterfaceobject *acad "AutoCAD.AcadLayerStateManager.17"))
(vla-setdatabase lstates (vla-get-database doc))
(vla-save lstates "ColorLType" (+ acLsColor acLsLineType))
(vla-restore lstates "ColorLType")
(vla-delete lstates "ColorLType")
(vla-regen doc acActiveViewport)
(princ)
)
-
(vla-regen doc acActiveViewport)
Thanks...
but look at my message above...
-
I did, and I tested it and it did not work in 2 drawings I tested it with. The folks I spoke with that came up with this idea verified it as well.
To be sure, I just now tested and unless I use the method posted earlier the layer stays faded.
I modified my test to have the regen occur between the double setting of the sysvar and this does work.
(defun c:locktest2 (/ lays *acad doc lay fadeset)
(setq *acad (vlax-get-acad-object)
doc (vla-get-activedocument *acad)
lay (vla-item (vla-get-layers doc) "Layer1")
)
(if (= :vlax-true (vla-get-lock lay))
(vla-put-lock lay :vlax-false)
(vla-put-lock lay :vlax-true)
)
(setq fadeSet (vla-getvariable doc "LAYLOCKFADECTL"))
(vla-setvariable doc "LAYLOCKFADECTL" 0)
(vla-regen doc acActiveViewport)
(vla-setvariable doc "LAYLOCKFADECTL" fadeSet)
(princ)
)
Oh, wait.....are you talking about this?:
it's good... but very heavy... :|
If so, then yes, it's "heavy". Either posted method requires the use of regen, but short of Autodesk supplying a fix to the API I don't see a better way.
-
OK !
thank you very much...
-
'he aint heavy, he's my brother'
[ dedicated to soulmates who survived the 60's ]
useful solution Jeff !