using vla-put-freeze

using vla-put-freeze

Dean_Scott
Enthusiast Enthusiast
3,231 Views
5 Replies
Message 1 of 6

using vla-put-freeze

Dean_Scott
Enthusiast
Enthusiast

Hey, folks...

I am trying (vla-put-layeron MyLayer :vlax-true) and (vla-put-freeze MyLayer :vlax-false) for the first time.

 

If MyLayer is off (but not frozen) at the start of my command, everything works great.

If MyLayer is frozen at the start, entities added via code show up fine, but pre-existing entities do not appear until my code terminates and I manually execute a redraw.

 

What am I missing?

Izzy

0 Likes
Accepted solutions (1)
3,232 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor

This is probably a native autocad feature because anything frozen requires a regen after the layer is thawed.

My 2 cents.

 

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 6

Dean_Scott
Enthusiast
Enthusiast

In general, I like updating my old lisps to remove command calls because I prefer cleaner code, but in this case how am i supposed to use visual lisp to manage layer states?

0 Likes
Message 4 of 6

dbroad
Mentor
Mentor
Accepted solution

There is nothing unclean about command calls.  That said, @paullimapa said all you need is an update.  For example

(setq ac (vlax-get-acad-object)
      do (vla-get-activedocument ac)
      lays (vla-get-layers do)
      la  (vla-item lays "one")
      )
(vla-put-freeze la :vlax-false)
(vla-regen do acAllViewports)

update the document object after thawing the layer to cleanup.

 

Converting command calls to activeX code is basically a waste of time IMO though.

Architect, Registered NC, VA, SC, & GA.
Message 5 of 6

Dean_Scott
Enthusiast
Enthusiast

Glad to hear you think so.

Like I said, I like my code to be clean, so if command calls are not passé I suppose I'll leave them alone.

There is always vl-cmdf I suppose...

Have a great day!

0 Likes
Message 6 of 6

Anonymous
Not applicable

One reason you might not want to use command-line "-LAYER" is that certain layer names do not work right with "-LAYER", specifically layer names with the "at" symbol such as

 

text @ 96

 

Try it!  Create a new layer called "text @ 96" (without the quotes).  You can do this either with the Layer Dialog Box or with command-line -LAYER

 

-layer

n

text @ 96

 

Now try to turn it off with command-line -LAYER.

 

-layer

off

text @ 96

 

In AutoCAD 2014 or 2007 you'll see the message

 

No matching layer names found.

 

All right, the thirty-year-old -LAYER command is broken, and that means that any LISP you might have written using (command "-layer"...) is also broken.. So you might try modifying the entity data with tblobjname / entget /entmod.  But when you thaw a layer by that method, for some God-awful reason AutoCAD doesn't regenerate the entities on that layer on the screen, not even if you do the REGEN or REGENALL commands... What does work is if you switch to a different layout tab and do REGENALL from there.

 

AutoCAD!  More fun than anything that makes sense.

0 Likes