Jump to content

Recommended Posts

Posted

I had a question in regards to how to properly format ssget (I am using Lee's special LM:ssget function just so that I can add in text) when I use list and cons. I have looked at afralisp's tutorial, and I tried to apply it, but it isn't working properly. My code is

(setq ss
                 (LM:ssget "\nSelect destination object(s): "
                           '(((list (cons 0 ent0))))
                 )
          )

Where ent0 is:

(setq ent0 (assoc 0 (entget (car ent))))

Posted

broncos,

 

What is the value of ent ?

 

If it is an ENAME you should use:

 

(setq ent0 (assoc 0 (entget ent)))

 

With the above the value of ent0 will be: (0 . "typeofentity")

means you don't need to do a cons

 

So using the wrapper:

 

(setq ss  (LM:ssget "\nSelect destination object(s): "  (list (list ent0))))

Posted
broncos,

 

What is the value of ent ?

 

If it is an ENAME you should use:

 

(setq ent0 (assoc 0 (entget ent)))

With the above the value of ent0 will be: (0 . "typeofentity")

means you don't need to do a cons

 

So using the wrapper:

 

(setq ss  (LM:ssget "\nSelect destination object(s): "  (list (list ent0))))

Ah, that makes sense. Thanks, I am now able to select things, now it's just debugging the rest of the code haha.
Posted

Broncos15,

 

You are Welcome!!

 

May I suggest that you keep variable name like ent0 or ent to represent ENAME.

In your case maybe filter or flt would probably be a better choice of name.

 

ymg

Posted
Broncos15,

 

You are Welcome!!

 

May I suggest that you keep variable name like ent0 or ent to represent ENAME.

In your case maybe filter or flt would probably be a better choice of name.

 

ymg

Thanks ymg3, I'll start incorporating that coding practice into my LISPs. I had a quick question on why I have to use 2 different list functions. I understand why I need to use the first one, but I can't figure out why I need the second one.
Posted (edited)

broncos,

 

For your question, you need it because nothing gets evaluated inside the quote list

for example:

 

'((list ent0)) will return  ((LIST ENT0))

 

So replacing the quote with list you get :

 

(list (list ent0))    --->   (((0 . "ELLIPSE")))

 

The wrapper function is expecting a list of list as an argument.

First item in that list can be scope of search for example "_X"

followed by the filter clause. But filter must be list of list.

 

So you end up with something like this:

 

(lm:ssget "\n Your message: " (list "_X" (list ent0)))

ymg

Edited by ymg3
Posted
broncos,

 

For your question, you need it because nothing gets evaluated inside the quote list

for example:

 

'((list ent0)) will return  ((LIST ENT0))

So replacing the quote with list you get :

 

(list (list ent0))    --->   (((0 . "ELLIPSE")))

The wrapper function is expecting a list of list as an argument.

 

ymg

Thanks ymg! That was very useful. I'm always trying to learn more about LISP programming so I really appreciate the explanation.

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