Code Red > AutoLISP (Vanilla / Visual)
attribute detector...
Andrea:
Hi all...
I'm trying to detect if there is some attribute in a drawing..
:|
CAB:
Why not use ssget?
Kerry:
Have a play with this .. but you really only need the first line, as CAB mentioned .. the rest is fluff.
--- Code: ---(IF (SETQ ss (SSGET "X" '((0 . "INSERT") (66 . 1)))
)
(MAPCAR
'(LAMBDA (ent)
(LIST
(VLA-GET-NAME
(VLAX-ENAME->VLA-OBJECT ent)
)
(MAPCAR
'(LAMBDA (Att)
(CONS
(VLA-GET-TAGSTRING
Att
)
(VLA-GET-TEXTSTRING
Att
)
)
)
(VLAX-INVOKE
(VLAX-ENAME->VLA-OBJECT
ent
)
"GetAttributes"
)
)
)
)
(REPEAT (SETQ len (SSLENGTH ss))
(SETQ len (1- len)
l (CONS (SSNAME ss len) l)
)
)
)
)
--- End code ---
Edit: Maverick will help you if you have any problems.
Kerry:
.. returning something like this ..
--- Quote ---(
("8700-31" (("LABEL" . "DETAIL") ("DET" . "S3d")
("DWG" . "W701")
("N1" . " ")
("N2" . " ")
("N3" . " ")
)
)
("W-03N" (("S" . "") ("R" . "") ("A" . "")))
("W-15T"
(("N1" . "FLG'S") ("N2" . "& WEB") ("N3" . ""))
)
("W-04N" (("S" . "") ("R" . "") ("A" . "")))
("W-04N" (("S" . "") ("R" . "") ("A" . "")))
("8700-31" (("LABEL" . "DETAIL") ("DET" . "S3c")
("DWG" . "W101")
("N1" . " ")
("N2" . " ")
("N3" . " ")
)
)
("8700-31" (("LABEL" . "DETAIL") ("DET" . "S3b")
("DWG" . "W101")
("N1" . " ")
("N2" . " ")
("N3" . " ")
)
)
("8700-31" (("LABEL" . "DETAIL") ("DET" . "S3a")
("DWG" . "W101")
("N1" . " ")
("N2" . " ")
("N3" . " ")
)
)
("W-04N" (("S" . "") ("R" . "") ("A" . "")))
("W-04N" (("S" . "") ("R" . "") ("A" . "")))
("BORDER-A1-DET-A016"
(("DWG_NO_C" . "A016-S3")
("FOR_CON" . "FOR APPROVAL")
("REV_BOX" . "A")
("TITLE-1" . "ROM DUMP POCKET - DUMP HOPPER")
("TITLE-2" . "STRUCTURAL STEELWORK DETAILS")
("TITLE-3" . "SITE WELD DETAILS")
("DRAWN" . "RMK")
("DRAWN_DATE" . "MAY 06")
("REV_1" . "A")
("REV_1_T" . "ISSUED FOR APPROVAL")
("REV_1_D" . "DOC")
("REV_1_C" . "CTA")
("REV_1_A" . "CTA")
("REV_1_DA" . "JUN 13")
("DWG_MASS" . "")
)
)
)
--- End quote ---
Andrea:
--- Quote from: CAB on July 01, 2006, 12:56:47 AM ---Why not use ssget?
--- End quote ---
I was trying CAB....but not sure about how..
Thanks Kerry....
but guys......seriously....your to hot for me...
i'm lost when you r using VLAX VLR and other stuff like that..
i'm trying to lurn...but time missing..
So now....
this is my problem..
When using this code more than 3 times...
--- Code: ---(setvar "attreq" 0)
(setq CBF (strcat "1" "=" "c:\\1.dwg"))
(vl-cmdf "_.-insert" CBF pause "1" "1" pause)
(if (ssget "X" '((0 . "INSERT") (66 . 1)))
(command "_.attsync" "_N" "1.dwg" ))
(command "_.explode" (entlast))
(setvar "attreq" 1)
--- End code ---
i receive this ended message.
and AutoCAD close.
WHY !?
What i'm doing wrong ?
(note: the block is a simple block containing a simple attribute)
Navigation
[0] Message Index
[#] Next page
Go to full version