Jump to content

Toggle layer freeze/thaw


samifox

Recommended Posts

Here is a simple example:

(defun c:ftog ( / layer l )
   (setq layer "0") ;; Layer to Freeze/Thaw
   (cond
       (   (= (strcase (getvar 'clayer)) (strcase layer))
           (princ "\nCannot freeze the current layer.")
       )
       (   (setq l (tblobjname "LAYER" layer))
           (setq l (vlax-ename->vla-object l))
           (vlax-put l 'freeze (~ (vlax-get l 'freeze)))
       )
       (   (princ (strcat "\nLayer " layer " does not exist.")))
   )
   (princ)
)
(vl-load-com) (princ)

Link to comment
Share on other sites

and Lee...

 

i excecute your code..

when trying to toggle on i have to regen so the objects re-appear

 

how can i regenerate in the code?

Link to comment
Share on other sites

8) all those starting with vlax

 

The vlax-ename->vla-object function converts the LAYER entity to a VLA-Object which may then be manipulated using its ActiveX Properties & Methods, rather than manipulating the DXF Group codes of the LAYER entity.

 

I am then manipulating the Freeze property of the VLA Layer Object using the undocumented vlax-get / vlax-put functions, since these functions return native AutoLISP data types, rather than the Visual LISP :vlax-true / :vlax-false symbols as returned by vlax-get-property or vla-get-freeze.

 

As for the toggle itself, consider:

_$ (~ 0)
-1
_$ (~ -1)
0

Link to comment
Share on other sites

  • 2 years later...
The vlax-ename->vla-object function converts the LAYER entity to a VLA-Object which may then be manipulated using its ActiveX Properties & Methods, rather than manipulating the DXF Group codes of the LAYER entity.

 

 

As for the toggle itself, consider:

_$ (~ 0)
-1
_$ (~ -1)
0

 

what did you mean by that Lee ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...