ssget "_w" variable points

ssget "_w" variable points

Anonymous
Not applicable
1,570 Views
8 Replies
Message 1 of 9

ssget "_w" variable points

Anonymous
Not applicable

I seem to be struggling with using variables as points. Can anyone point me in the right direction?

 

(defun c:test ( / topright bottomleft dwgarea a b c d )

	(setq 	bottomleft (getpoint "Please pick a point in the Bottom Left corner of the drawing area:")
		topright (getpoint "Please pick a point in the Top Right corner of the drawing area:")
		a (+ (car bottomleft) 0.1)
		b (+ (cadr bottomleft) 0.1)
		c (- (car topright) 0.1)
		d (- (cadr topright) 0.1)
		bottomleft '(a b)
		topright '(c d)
		dwgarea '(bottomleft topright)
	)

(print a)
(print b)
(print c)
(print d)

	(setq	testss (ssget "_W" 'bottomleft 'topright '((0 . "TEXT"))))

	(command "change" testss "" "Properties" "Color" "5" "" "")
)

 

Just getting Bad Point argument or too many arguments 😕 Cheers

0 Likes
Accepted solutions (1)
1,571 Views
8 Replies
Replies (8)
Message 2 of 9

dbroad
Mentor
Mentor
Accepted solution

1) You should use vlide to debug.

2) You should  not wrap 9 variable assignments into a single setq because it makes everything more difficult to debug.

3) In vlide, you should double click next to the parenthesis on each setq and load selected.  Examine each return value.  Doing that would have enabled you to find your error in less time that it would have taken to make a forum post.

 

 

'(a b) returns '(a b).  Quoting a list keeps that list from being evaluated.  To return a point list, use (list a b).  Note: You are returning only 2d points.

 

So bottomleft is just a list of symbols.  Topright is a list of symbols.  DWGAREA is a list of lists of symbols.

 

Don't quote symbols passed to ssget, except the '((0 . "text"))

 

Don't start a command function without testing whether the selectionset exists.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 9

john.uhden
Mentor
Mentor

And...

Don't covet thy neighbor's wife (though the neighbor himself might be okay to some).  😕

John F. Uhden

0 Likes
Message 4 of 9

ВeekeeCZ
Consultant
Consultant

Although there is one more...

 

Make sure that the window you're making for the selection is on a visible part of screen! Consider temporarily zooming to the selection window before performing the selection, and then zoom previous to restore the original screen position.

Message 5 of 9

dbroad
Mentor
Mentor

Smiley Wink

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 6 of 9

Anonymous
Not applicable

Thanks very much to all of you for the help and advice, I've now got it running. 🙂

0 Likes
Message 7 of 9

john.uhden
Mentor
Mentor

Thank you @dbroad for acknowledging my extruded attempts at humor.

I miss Take5.

John F. Uhden

0 Likes
Message 8 of 9

dbroad
Mentor
Mentor

Stick around long enough and you might be invited to be an expert elite.  There is a forum there for off-topic posts but I don't visit often.

 

Hmmm.  Extruded.  Was that a closed or an open argument that you extruded?  Did it result in a solid argument or su<pe>rficial one?

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 9 of 9

john.uhden
Mentor
Mentor

I dunno, but I'm pretty sure it was rigged.

Oh boy, off-color posts!

John F. Uhden

0 Likes