See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: How to use Layer names with spaces in

  1. #1
    Active Member
    Join Date
    2004-11
    Posts
    55
    Login to Give a bone
    0

    Question How to use Layer names with spaces in

    Hey everyone, i need a little help with making a custom button. Well I already have it made i was just trying to add some functionality to it and i hit a road block. What i want it to do is freeze 3 certain layers only problem is these three layers have a space in there name so it just stops when it hits the space and says it cant find the layer. so instead of finding the layer DELTA POINT it says it cant find the layer DELTA.... is there any character that represents a space.

    Thanks for any help

  2. #2
    AUGI Addict Glenn Pope's Avatar
    Join Date
    2001-05
    Location
    Austin, TX USA
    Posts
    2,201
    Login to Give a bone
    0

    Default Re: How to use Layer names with spaces in

    Try putting quotations ( " ) around your layer name in your button.

    ex
    "DELTA POINT"

  3. #3
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: How to use Layer names with spaces in

    You could use an underscore in the layer names but -

    first try surrounding the layer name with quotes in the macro - "Delta Point".

  4. #4
    Retired Forum Staff Chris.N's Avatar
    Join Date
    2001-12
    Location
    Rochester, MN
    Posts
    2,561
    Login to Give a bone
    0

    Thumbs up Re: How to use Layer names with spaces in

    Hello,
    I just did a command line layer freeze on a layer name with spaces. Use quotes (") at beginning and end of layer name(s). Hope you get it to work!

  5. #5
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    1

    Default Re: How to use Layer names with spaces in

    Here's mine, mod as needed:

    LayerToggle.lsp
    Code:
     (DEFUN c:def (/ |layer|)
       (SETVAR "cmdecho" 0)
       (COMMAND "._undo" "be")
       (SETQ |layer| "Defpoints")
       (layertoggle)
       (COMMAND "._undo" "e")
       (SETVAR "cmdecho" 1)
       (PRINC)
     )
     
     (DEFUN c:dims (/ |layer|)
       (SETVAR "cmdecho" 0)
       (COMMAND "._undo" "be")
       (SETQ |layer| "dimensions")
       (layertoggle)
       (COMMAND "._undo" "e")
       (SETVAR "cmdecho" 1)
       (PRINC)
     )
     
     (DEFUN c:dwg (/ |layer|)
       (SETVAR "cmdecho" 0)
       (COMMAND "._undo" "be")
       (SETQ |layer| "dwgtexture")
       (layertoggle)
       (COMMAND "._undo" "e")
       (SETVAR "cmdecho" 1)
       (PRINC)
     )
     
     (DEFUN c:ga (/ |layer|)
       (SETVAR "cmdecho" 0)
       (COMMAND "._undo" "be")
       (SETQ |layer| "G-ANNO-NPLT")
       (layertoggle)
       (COMMAND "._undo" "e")
       (SETVAR "cmdecho" 1)
       (PRINC)
     )
     
     (DEFUN layertoggle (/ |assoc62| |assoc70| |dcl_id|)
     ;;; need to define error code - not done yet.
       (IF (TBLSEARCH "layer" |layer|)
     	(PROGN
     	  (SETQ
     	|assoc62| (CDR (ASSOC 62 (TBLSEARCH "LAYER" |layer|)))
     	|assoc70| (CDR (ASSOC 70 (TBLSEARCH "LAYER" |layer|)))
     	  ) ;_ end of setq
     	  (IF (= (GETVAR "clayer") |layer|)
     	(COMMAND "clayer" 0)
     	  ) ;_ end of if
     	  (COND
     	((AND (> |assoc62| 0) (> |assoc70| 0))		     ;on-freeze
     	 (PROGN
     	   (SETQ |dcl_id| (LOAD_DIALOG "LayerToggle.dcl"))
     	   (IF (NOT (NEW_DIALOG "LayerToggle" |dcl_id|))
     		 (EXIT)
     	   ) ;_ end of if
     	   (ACTION_TILE "tn" "(setq |answer| 2)")
     	   (ACTION_TILE "ff" "(setq |answer| 1)")
     	   (ACTION_TILE "cancel" "(exit)")
     	   (START_DIALOG)
     	   (UNLOAD_DIALOG |dcl_id|)
     	   (COND
     		 ((= |answer| 1) (freezeoff))
     		 ((= |answer| 2) (thawon))
     	   ) ;_ end of cond
     	 ) ;_ end of progn
     	)
     	((AND (< |assoc62| 0) (= |assoc70| 0))		     ;off-thaw
     	 (PROGN
     	   (SETQ |dcl_id| (LOAD_DIALOG "LayerToggle.dcl"))
     	   (IF (NOT (NEW_DIALOG "LayerToggle" |dcl_id|))
     		 (EXIT)
     	   ) ;_ end of if
     	   (ACTION_TILE "tn" "(setq |answer| 2)")
     	   (ACTION_TILE "ff" "(setq |answer| 1)")
     	   (ACTION_TILE "cancel" "(exit)")
     	   (START_DIALOG)
     	   (UNLOAD_DIALOG |dcl_id|)
     	   (COND
     		 ((= |answer| 1) (freezeoff))
     		 ((= |answer| 2) (thawon))
     	   ) ;_ end of cond
     	 ) ;_ end of progn
     	)
     	((AND (> |assoc62| 0) (= |assoc70| 0))		     ;on-thaw
     	 (freezeoff)
     	)
     	((AND (< |assoc62| 0) (> |assoc70| 0))		     ;off-freeze
     	 (thawon)
     	)
     	(T nil)
     	  ) ;_ end of cond
     	) ;_ end of progn
     	(ALERT "\nLayer does not exist!!! ")
       ) ;_ end of if
     ) ;_ end of defun
     
     (DEFUN freezeoff (/)
       (PROGN
     	(COMMAND "_.-layer" "freeze" |layer| "")
     	(COMMAND "_.-layer" "off" |layer| "")
       ) ;_ end of progn
     ) ;_ end of defun
     
     (DEFUN thawon (/)
       (PROGN
     	(COMMAND "_.-layer" "thaw" |layer| "")
     	(COMMAND "_.-layer" "on" |layer| "")
       ) ;_ end of progn
     ) ;_ end of defun
    LayerToggle.dcl
    Code:
     LayerToggle : dialog {
     	label = "Freeze/Off or Thaw/On" ;
     	spacer_1 ;
     	initial_focus = _no ;
       : row {
     spacer ;
     	: button {
     	  key = "ff" ;
     	  label = "Freeze/Off" ;
     	  mnemonic = "F" ;
     	  width = 8 ;
     	  fixed_width = true ;
     	  is_cancel = true ;
     	}
     spacer ;
     	: button {
     	  key = "tn" ;
     	  label = "Thaw/On" ;
     	  mnemonic = "T" ;
     	  width = 8 ;
     	  fixed_width = true ;
     	  is_cancel = true ;
     	}
     spacer ;
       }
     spacer ;
       : row {
     spacer ;
     	: button {
     	  key = "cancel" ;
     	  label = "CANCEL" ;
     	  mnemonic = "C" ;
     	  width = 8 ;
     	  fixed_width = true ;
     	  is_cancel = true ;
     	}
     spacer ;
       }
     }

  6. #6
    Active Member
    Join Date
    2004-11
    Posts
    55
    Login to Give a bone
    0

    Default Re: How to use Layer names with spaces in

    Thanks for the replys. It works great!

Similar Threads

  1. 2015: AutoCAD 2015 doesn't like layer names with spaces and dashes
    By awander in forum AutoCAD General
    Replies: 1
    Last Post: 2014-06-19, 11:43 AM
  2. Room Names and Spaces
    By sjsl in forum Revit MEP - General
    Replies: 14
    Last Post: 2010-06-11, 06:22 PM
  3. Replies: 14
    Last Post: 2010-03-24, 05:13 AM
  4. Change Layer names to other Layer names via a script?
    By tburke in forum AutoCAD Customization
    Replies: 5
    Last Post: 2006-12-04, 07:30 PM
  5. Using Layer names with spaces in them, inside of a Script
    By amy.chen in forum AutoCAD Customization
    Replies: 3
    Last Post: 2006-04-06, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •