Jump to content

Recommended Posts

Posted

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? 

 

Posted

Remove the two quotes around the variable to enable the command to evaluate it.

  • Like 2
Posted

Thanks Tharwat, that worked but I also had to put quotes in the setq function.

Posted

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" "" "")

 

  • Thanks 1
Posted

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)

 

  • Like 1

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