Author Topic: Dim to BYLAYER script  (Read 1129 times)

0 Members and 1 Guest are viewing this topic.

John_Gray

  • Guest
Dim to BYLAYER script
« on: May 09, 2017, 07:56:07 AM »
good morning eveyrone,

   I have a .scr that is supposed to take my dimensions styles and set everything in them to "bylayer".  When i run it, it returns....
Command: _.dimclre
Enter new value for DIMCLRE <256>: 256
Command: _.dimclrd
Enter new value for DIMCLRD <256>: 256
Command: _.dimclrt
Enter new value for DIMCLRT <256>: 256
Command: _.dimstyle
Current dimension style: Standard   Annotative: No
Enter a dimension style option
[ANnotative/Save/Restore/STatus/Variables/Apply/?] <Restore>: _save
Enter name for new dimension style or [?]: Standard
That name is already in use, redefine it? <N>:_yes
Command: nil


Here is the code for the script:



(while ; make list of Dimension Styles
  (setq item (cdadr (tblnext "dimstyle" (not item))))
  (setq dimstylist (cons item dimstylist))
); while
(foreach dimsty dimstylist
  (command
    "_.dimstyle" "_restore" dimsty
    "_.dimclre" 256 "_.dimclrd" 256 "_.dimclrt" 256 ; all to Bylayer
    "_.dimstyle" "_save" dimsty "_yes"
  ); command
); foreach




Any idea why this might be happening. 


Thank you to all in advance.

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Dim to BYLAYER script
« Reply #1 on: May 09, 2017, 08:40:18 AM »
Are you questioning the "nil", because your code seems to work just fine.


You could wrap the whole thing in a (defun) and use (princ) at the end.


Code: [Select]



(defun c:dimfix (/ item dimstylist dimsty)
  (while ; make list of Dimension Styles
    (setq item (cdadr (tblnext "dimstyle" (not item))))
     (setq dimstylist (cons item dimstylist))
  ) ; while
  (foreach dimsty dimstylist
    (command
      "_.dimstyle" "_restore" dimsty      "_.dimclre"  256
      "_.dimclrd"  256 "_.dimclrt"  256 ; all to Bylayer
      "_.dimstyle" "_save" dimsty      "_yes"
     ) ; command
  )
  (princ)
)