Author Topic: using variables in selection sets  (Read 2351 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
using variables in selection sets
« on: July 28, 2014, 12:00:39 PM »
i know i asked this question before but im just cant find that post

forgive me for asking again
how can i get a variable to be used in a selection set

example:

Code: [Select]
(setq ss (ssget "x" ((nth 0 variable)))

BlackBox

  • King Gator
  • Posts: 3770
Re: using variables in selection sets
« Reply #1 on: July 28, 2014, 12:11:02 PM »
More information about your 'variable' may be needed; perhaps try changing this:

Code: [Select]
(setq ss (ssget "x" ((nth 0 variable)))

... To something like this (which assumes the NTH call returns a valid grouped pair):

Code: [Select]
(setq ss (ssget "x" (list (nth 0 variable)))
"How we think determines what we do, and what we do determines what we get."

andrew_nao

  • Guest
Re: using variables in selection sets
« Reply #2 on: July 28, 2014, 01:11:06 PM »
im not having much luck with anything im trying.

(setq ss (ssget "X" (list (nth 0 lst)))) this was the line i tried and i just get errors with it.

ive also tried
(setq var "hello")
(setq ss (ssget "X" (list (cons 0 var)))

still nothing



BlackBox

  • King Gator
  • Posts: 3770
Re: using variables in selection sets
« Reply #3 on: July 28, 2014, 01:16:13 PM »
im not having much luck with anything im trying.

(setq ss (ssget "X" (list (nth 0 lst)))) this was the line i tried and i just get errors with it.

ive also tried
(setq var "hello")
(setq ss (ssget "X" (list (cons 0 var)))

still nothing

... As I said:

More information about your 'variable' may be needed...

... To something like this (which assumes the NTH call returns a valid grouped pair):



Let's start over... If your variable var is a string, that represents a valid object type, then:

Code: [Select]
(setq var "LINE")

(setq ss (ssget "x" (list (cons 0 var)))
"How we think determines what we do, and what we do determines what we get."

andrew_nao

  • Guest
Re: using variables in selection sets
« Reply #4 on: July 28, 2014, 03:40:51 PM »
got it working thank for your help

BlackBox

  • King Gator
  • Posts: 3770
Re: using variables in selection sets
« Reply #5 on: July 28, 2014, 03:44:50 PM »
got it working thank for your help

You're welcome; I'm happy to help.

Cheers
"How we think determines what we do, and what we do determines what we get."