Author Topic: 2008 : The layer locked... not attenuate ?  (Read 3119 times)

0 Members and 1 Guest are viewing this topic.

Bred

  • Guest
2008 : The layer locked... not attenuate ?
« on: July 13, 2007, 03:38:23 AM »
Hello everybody,
for 2008.
When I makes :
Code: [Select]
(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)

Code: [Select]
(command "_-layer" "_lock" "Layer" "" "")it's good... but  :-(

an idea?

thank you

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2008 : The layer locked... not attenuate ?
« Reply #1 on: July 13, 2007, 10:50:19 AM »
Check out THIS post.

Oh, and welcome to theSwamp!

Bred

  • Guest
Re: 2008 : The layer locked... not attenuate ?
« Reply #2 on: July 13, 2007, 11:11:58 AM »
Thanks!

But:
Code: [Select]
  (setq fadeSet(vla-getvariable activeDoc "LAYLOCKFADECTL"))
(vla-setvariable activeDoc "LAYLOCKFADECTL" 0)
(vla-setvariable activeDoc "LAYLOCKFADECTL" fadeSet)
for locked : OK
for unlocked : No....  :|

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2008 : The layer locked... not attenuate ?
« Reply #3 on: July 13, 2007, 07:02:40 PM »
Heh, you are absolutely correct! Now why didn't anyone else catch that? Let me see what I can find out.

Bred

  • Guest
Re: 2008 : The layer locked... not attenuate ?
« Reply #4 on: July 17, 2007, 12:27:10 PM »
Hello, then :  :?

Code: [Select]
(vla-Regen (vla-get-activedocument (vlax-get-acad-object)) acActiveViewport)it's good... but very heavy...  :|

and

Code: [Select]
(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

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2008 : The layer locked... not attenuate ?
« Reply #5 on: July 19, 2007, 01:36:31 PM »
Hi Bred,
The answer I got from the higher ups is:
Quote
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:
Code: [Select]
;;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)
  )

Bred

  • Guest
Re: 2008 : The layer locked... not attenuate ?
« Reply #6 on: July 19, 2007, 06:28:30 PM »
Code: [Select]
(vla-regen doc acActiveViewport)Thanks...
but look at my message above...

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: 2008 : The layer locked... not attenuate ?
« Reply #7 on: July 19, 2007, 07:26:56 PM »
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.

Code: [Select]
(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.

Bred

  • Guest
Re: 2008 : The layer locked... not attenuate ?
« Reply #8 on: July 20, 2007, 02:55:20 AM »
OK !   
thank you very much...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 2008 : The layer locked... not attenuate ?
« Reply #9 on: July 20, 2007, 03:29:52 AM »
'he aint heavy, he's my brother'

[ dedicated to soulmates who survived the 60's ]


useful solution Jeff !
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.