pttr Posted June 11, 2022 Posted June 11, 2022 Hi dumb question why cant i asign coordinates to a variable? ;Insert BSL_L6 (defun c:ph (/ co) (setq co 0,0) ;sett coordinates not working (command "-insert" "BSL_L6" "co" "100" "" "") ) If i put it in manually there is no problem. What am i doing wrong? Quote
Tharwat Posted June 11, 2022 Posted June 11, 2022 Remove the two quotes around the variable to enable the command to evaluate it. 2 Quote
pttr Posted June 11, 2022 Author Posted June 11, 2022 Thanks Tharwat, that worked but I also had to put quotes in the setq function. Quote
Tharwat Posted June 11, 2022 Posted June 11, 2022 You're welcome. You either wrap the value as a string ( with two quotes ) or keep it as value and both should work because the command call accepts both. e.g: (setq co 0,0) ;; or the following (setq co "0,0") (command "-insert" "BSL_L6" co "100" "" "") 1 Quote
Steven P Posted June 11, 2022 Posted June 11, 2022 If you define 0,0 in co as a list, that should work: (setq co (list 0 0)) of (setq co '(0 0)) The difference being '( makes the string fixed so what follows is exactly as it is used, list( allows you to calculate the list items or refer to other variables (setq String1 ("Hello") ) (setq string2 ("World") ) (setq mylist (list String1 String2)) -> is seen as (Hello World) (setq mylist '(Strng1 String2)) -> is seen as (String1 String2) (though might throw up an error wanting "" around the text strings) 1 Quote
Recommended Posts
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.