Two seemingly equal dotted pairs dont match

Two seemingly equal dotted pairs dont match

Anonymous
Not applicable
1,084 Views
5 Replies
Message 1 of 6

Two seemingly equal dotted pairs dont match

Anonymous
Not applicable

I'm trying to create a dotted pair, to do a ssget search.

Byt i always get an error.

I can wite it in a setq like I'v done with "test" and it works. But when i try to use the search value, it dont work.


Why does the lines below give me the result: "nil" and not "T"?!

(setq xref "A")
(setq search (cons '2 xref))
(setq test '(2 . "A"))
(= test search)

 

 

 

Thank you for Rrading my problem!

 

0 Likes
Accepted solutions (2)
1,085 Views
5 Replies
Replies (5)
Message 2 of 6

doaiena
Collaborator
Collaborator
Accepted solution

Use "equal".

(equal test search)
T

0 Likes
Message 3 of 6

cadffm
Consultant
Consultant

test and search refered a  list, only the result is EQUAL

=
should only used for numbers and strings, for symbols only if you know that the values are numbers or strings..

eq
check if the refer (internal) object is the same (pointed to the same identity)

equal
compare the evaluated results

 

Sebastian

0 Likes
Message 4 of 6

Anonymous
Not applicable

I dont know if I should start a new tread, but i dont want to spam the fourm with new threads.

 

Now I don't eaven know what my problem is.

 

I'm trying to extract the information from the Xrefs in a drawing.

I have succeeseded to save a list of all my xrefs as XrefList.

 

Command: !Xreflist
("D" "C" "B" "A")
(foreach xref XrefList
	(progn
		(setq search  (cons '2 xref))
		(setq ENT (entget (ssname (ssget "_X" (2 . "A"))0)))
		(setq coordinates (cdr (assoc 10 ENT)))
	)

)

Will generate:

bad argument type: consp "A"

 

Here is the xref I'm trying to get information from.

Xref WindowXref Window

0 Likes
Message 5 of 6

cadffm
Consultant
Consultant
Accepted solution
(ssget "_X" (2 . "A"))

(ssget "_X" '((2 . "A")))
(ssget "_X" (list'(2 . "A"))

(ssget "_X" (list(cons 2 xref)))


'2 => you dont need 'quote numbers and chars, both evaluate to himself


And what you want to do with your selectionset?
(ssname selectionset 0) get only the FIRST (external)blockreference,
but you can have 100 insertes of xref "a"


 

Sebastian

Message 6 of 6

Anonymous
Not applicable

It soleved the problem!

Thank you very much!

 

This is just a test file to make my script to work the xrefs names will be somthing like VS-50-P-80013500-09.

Im gonna use it in a hospital with 100+ drawings with atleast 10 xrefs in each drawing.

Some of the conuslts working in the files, have a bad habit to move the xrefs.

 

My plan is to make an script to go through all the files. Then generate a report of all the moved xrefs.

Yet i havent found any xrefs inserted more than one time.

 

0 Likes