Jump to content

AutoCAD Variable rejected CELWEIGHT


Recommended Posts

Posted

My code that I've had for a while (I wrote some of it, then someone else helped modify it on this forum years ago):

(defun c:tst(/ varLst varVal *error*)
 
 
; **** ERROR HANDLER **** restore your variables in case of error or Esc
 (defun *error*(msg)
; restore your variables at once
   (mapcar 'setvar varLst varVal)
; print error message in command line
   (princ msg)
; silent exit
   (princ)
   ); end of *error*

 
 ; **** MAIN CODE ****
 ; store variables list
 (setq varLst(list "CLAYER" "CELTYPE" "CECOLOR" [color="red"]"CELWEIGHT"[/color])
 ; get all variables at once
       varVal(mapcar 'getvar varLst)
); end setq
 ; set new variables values at once
 (mapcar 'setvar varLst (list "M-HVAC-TSTAT" "DASHDOT2" "3" [color="red"]"20"[/color]))
 ; invoke _spline command
 (command "_.spline")
 ; while command is active do pause for user input
 (while(= 1(getvar "CMDACTIVE"))
   (command pause)
  ); end while
 ; restore your variables at once
 (mapcar 'setvar varLst varVal)
 ; silent exit
 (princ)
 ); end of c:tst

The code has always worked. I wanted to add a quick change to also include changing the object lineweight. The items I highlighted in Red is the only thing I added, then I receive this error:

Command: TST AutoCAD variable setting rejected: "CELWEIGHT" "20"

Any help would be appreciated, thanks!

 

-TZ

Posted

Thanks for replying. What is INT? Is it returning as an Integer? Do I not have the right format? Sorry if this is a dumb question, just trying to follow. :)

 

-TZ

Posted

Lee, are you saying the quotes should be left off because celweight is an integer? So 20 instead of "20" ?

Posted
Lee, are you saying the quotes should be left off because celweight is an integer? So 20 instead of "20" ?

 

Tannar, I think rkent is on target there, lose the quotes and give it a try, what's to lose?

Posted

That worked!! Thanks for the tips gentlemen. Everything is working as expected.

 

-TZ

Posted

Sorry for the radio silence...

 

What is INT? Is it returning as an Integer? Do I not have the right format?
are you saying the quotes should be left off because celweight is an integer? So 20 instead of "20" ?
lose the quotes and give it a try

 

Bingo! :)

 

That worked!! Thanks for the tips gentlemen. Everything is working as expected.

 

-TZ

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...