Print Page | Close Window

Freeze Layers containing spaces?

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=896
Printed Date: 19.Apr.2026 at 19:54


Topic: Freeze Layers containing spaces?
Posted By: Xsoldier2000
Subject: Freeze Layers containing spaces?
Date Posted: 14.Jul.2008 at 20:22
I'm trying to write a script to mass freeze certain layers in my drawings, but because we receive drawings from an architect, they contain spaces (eg. THIS LAYER|Pool Competition$10$1-pool)

Any idea how this might be done? As AutoCAD scripts read spaces as an ENTER key I can't just copy/paste the layer name. Also, when I insert a %20 (normally used for a space) AutoCAD reads it as part of the layer name.


Any Help?

Or maybe I should be looking into a LISP? I honestly don't know the first thing about writing a LISP though.

Thanks for any help possible.



Replies:
Posted By: Vladimir Michl
Date Posted: 14.Jul.2008 at 21:08
There is no need for a LISP - a plain macro:
 _-LAYER _Freeze * *
will work.
You can use spaces in layer names (in scripts) as long as the EXTNAMES variable is set to 1.


-------------
Vladimir Michl (moderator)
ARKANCE - https://arkance.world" rel="nofollow - https://arkance.world - Autodesk Platinum Partner


Posted By: Xsoldier2000
Date Posted: 14.Jul.2008 at 21:17
Ok, my EXTNAMES is set to 1 (allowing for AutoCAD 2000(+) parameters)

An example of my script:

-layer
F
*|Competition Pool$0$SP-CP-WP-2-ROPE f *|s-grid-iden-384

When running the script it still stops after the Competition when trying to freeze *|Competition Pool$0$SP-CP-WP-2-ROPE.  (eg. [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]: F

Enter name list of layer(s) to freeze or <select objects>: *|Competition
No matching layer names found.
)

BTW, I am using AutoCAD 2008.

Thank you again for any help.

Update: I just found this...Will try it our tomorrow.

To quickly replace spaces in layer names use the following VBA macro (use e.g. the _VBASTMT command to run it):

For Each objLayer In ThisDrawing.Layers : objLayer.Name=Replace(objLayer.Name, " ", "_") : Next




Print Page | Close Window