Jump to content

Recommended Posts

Posted

Hello everyone! 

So, i am doing a school project in which i want to select all circles of a given radius and then move them all in the arithmetic mean of all centers. The arithmetic mean is no problem, everything works fine, till i add the "more complex" filter. Here is the part of the code:

 

(initget 7)                    
(setq radius (getint "\nEnter radius: "))

(setq ss (ssget "X" '((0 . "CIRCLE") (-4 . "=") (40 . radius)))) 

 

The thing is, when i swap (40 . radius) with, lets say, (40 . 10)... it works for all circles with the radius equal to 10. But i want to give the radius by keyboard. And i get the error from the title. Also... if i put a (princ radius) before the filter, it shows me the value of radius. 

 

Posted

The issue is your use of the apostrophe to quote the ssget filter list as a literal list, resulting in the radius variable being intrepreted as a symbol rather than being evaluated to yield the value that the variable has been assigned. I would strongly suggest reading my tutorial on The Apostrophe and the Quote Function to understand why this issue arises, and how to solve it.

  • Like 2
Posted

@Lee Mac Thank you! The tutorial really helped, I figured it out and now I understand 👍.

Posted
On 5/12/2021 at 7:10 PM, TudorN said:

@Lee Mac Thank you! The tutorial really helped, I figured it out and now I understand 👍.

 

Excellent - I'm glad to hear it! You're most welcome 🍻

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