Jump to content

cannot use cons in ssget


Recommended Posts

Posted

Trying to extract a name I generate and add to a list for use in the ssget function. I keep getting bad point pair errors. Below is the offending line

(setq blks (ssget "x" (cons 2 (nth i nm))))

image.png.c42634bfe6f9d21e3ef8f2413f66cb6b.png

This is what's in the nth item. 

 

Below is the code i use to append an item into the list i'm trying to access in the ssget function

(setq names (append names (list (read (strcat partNum  "_" (nth (atoi (nth (setq index (1+ index)) dimension)) (cadr (nth 1 data))))))))

Ideas? I've tried everything from strcat, to using (assoc "names"  (nth i nm)) in my ssget call. Pretty stuck here.

Posted (edited)

So i realized it was a symbol, so i've used vl-symbol-name to retrieve the string name, but i'm still unable to send the (cons 2 (vl-symbol-name (nth i nm))) argument to the ssget function. I still get a bad point argument error. Please help.

Edited by brandalf_the_semiGray
Posted (edited)
1 hour ago, brandalf_the_semiGray said:

Trying to extract a name I generate and add to a list for use in the ssget function. I keep getting bad point pair errors. Below is the offending line


(setq blks (ssget "x" (cons 2 (nth i nm))))

image.png.c42634bfe6f9d21e3ef8f2413f66cb6b.png

This is what's in the nth item. 

 

Below is the code i use to append an item into the list i'm trying to access in the ssget function


(setq names (append names (list (read (strcat partNum  "_" (nth (atoi (nth (setq index (1+ index)) dimension)) (cadr (nth 1 data))))))))

Ideas? I've tried everything from strcat, to using (assoc "names"  (nth i nm)) in my ssget call. Pretty stuck here.

 

Only blocks have names. If you want to ssget all blocks with a certain name the filter needs to be in the format :

 

(ssget "x" (list '(0 . "INSERT") (cons 2 blkname)))

Where blkname is a string of block names separated with comma(s). What type of entity is SYM ?

Edited by dlanorh
Posted
1 hour ago, brandalf_the_semiGray said:

Trying to extract a name I generate and add to a list for use in the ssget function. I keep getting bad point pair errors. Below is the offending line


(setq blks (ssget "x" (cons 2 (nth i nm))))

...

Quick glance:

;; This
(setq blks (ssget "_X"  (cons 2 (nth i nm))))
;; Should be this
(setq blks (ssget "_X" (list (cons 2 (nth i nm)))))

 

Posted

oh man. that did it. thanks guys. I was reading the documentation for ssget and didn't catch that it needed to recieve a list for some reason

 

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