- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So right now i have a lisp that takes all of my keynotes in my drawing, and inserts their information into my title block.
The only issue is that the keynote block and the Mleader have to be separate objects in order for this to work. Instead of making a multileader style with the block connected to the leader. This creates issues where sometimes people are moving the block without the leader, or moving the leader without the block. Or when you want to move them it now requires two steps instead of 1. So I'm trying to fix that issue by creating a Mleader style with the block connected, then extracting the information from there.
This chunk of code I'm posting is part of a much much larger lisp routine that connects with all kinds of other dlls and stuff. However I'm pretty sure this line right here is the root of the problem. Originally it only looked for block references but then i added the "or" condition to also look for Mleaders. The only issue is that im pretty sure its looking for the attributes of the Mleader, and not the attributes of the block connected to the Mleader.
(if (and (or (= (vlax-get-property G-OBJ "ObjectName") "AcDbBlockReference")
(= (vlax-get-property G-OBJ "ObjectName") "AcDbLeader"))
I know this is a tough one but any help would be greatly appreciated. I've got very limited knowledge and have been working on this for days.
;;;--------------------------------------------------------------------;
;;; Subfunction: CPKS-GET-SYMBOLS ;
;;; Description: This function returns a sorted list of all keynote ;
;;; symbols in all spaces of current drawing including ;
;;; xrefs and binded blocks. ;
;;;--------------------------------------------------------------------;
(defun CPKS-GET-SYMBOLS (/ G-SS G-SYM G-TAG G-STRLEN
G-STRVAL G-OBJ G-ATTR G-I G-LST-SYM
G-ARR-ATTR G-OBJ-BLKS G-XREFDB G-XREFDB-MS G-NAME
G-LST-BADFAB G-BADFAB G-PART G-SYM-PART
)
;; Process Symbols in current space ;
(if (setq G-SS
(ssget
"x"
(list
'(0 . "INSERT")
'(2
.
"*PNT,*MAT,*ALUM,*STEEL,*ELEC,*FAB,*HDWE,*FABTEXT,*CP_KNMAT,*CP_KNPNT,*CP_KNHDW,*CP_KNELC,*CP_KNALM,*CP_KNSTL,*CP_KNFAB,*CP_KNFAB2,*CP_KNFAB3,*CP_KNPAR,*CP_KNPAR2,*CP_KNPAR3,*CP_KNREV,*CP_FTAG,*CP_FABTAG,*CP_FABTAG-S,*CP_FABTAG-XS,*CP_FABTAG-L,*CP_FABTAG-XL,*CP_PARTAG,*CP_PARTAG-S,*CP_PARTAG-XS,*CP_PARTAG-L,*CP_PARTAG-XL"
)
)
)
)
(while (> (sslength G-SS) 0)
(setq G-OBJ (vlax-ename->vla-object (ssname G-SS 0)))
(if (and (or (= (vlax-get-property G-OBJ "ObjectName") "AcDbBlockReference")
(= (vlax-get-property G-OBJ "ObjectName") "AcDbLeader"))
(= (vlax-get-property G-OBJ "HasAttributes") :vlax-true)
(setq
G-ARR-ATTR (vlax-safearray->list (vlax-variant-value (vla-getattributes G-OBJ)))
)
)
(progn
(foreach G-ATTR G-ARR-ATTR
(setq G-TAG (strcase (vlax-get-property G-ATTR "TagString"))
G-STRLEN (strlen (vlax-get-property G-ATTR "TextString"))
G-STRVAL (vlax-get-property G-ATTR "TextString")
G-SYM NIL
)
(cond
((member G-TAG (list "FAB" "FABNUM")) (setq G-SYM (strcase G-STRVAL)))
((= G-TAG "FABNO")
(setq G-SYM (strcase G-STRVAL)
G-SYM-PART G-SYM
)
)
((= G-TAG "PART") (setq G-PART (strcase G-STRVAL)))
((member G-TAG (list "F" "KNF"))
(setq G-SYM (strcat "F-"
(cond ((= G-STRLEN 3) (substr G-STRVAL 1))
((= G-STRLEN 2) (strcat "0" (substr G-STRVAL 1)))
((= G-STRLEN 1) (strcat "00" (substr G-STRVAL 1)))
(t (substr G-STRVAL (- G-STRLEN 2)))
)
)
G-SYM-PART G-SYM
)
(if (and (not (member G-STRLEN '(5 3))) (not (member G-STRVAL G-LST-BADFAB)))
(setq G-LST-BADFAB (append G-LST-BADFAB (list G-STRVAL)))
)
)
((member
G-TAG
(list "M" "P" "H" "E" "A" "S" "R" "PNT" "MAT" "ALUM" "STEEL" "ELEC" "HDWE")
)
(setq G-SYM (strcat (substr G-TAG 1 1) G-STRVAL))
)
((member G-TAG (list "KNP" "KNM" "KNH" "KNE" "KNA" "KNS"))
(setq G-SYM (strcat (substr G-TAG 3 1) G-STRVAL))
)
)
(if (and G-SYM (not (member G-SYM G-LST-SYM)))
(setq G-LST-SYM (append (list G-SYM) G-LST-SYM))
)
)
(if (and G-PART G-SYM-PART (not (assoc G-SYM-PART G_LST-PARTS)))
(setq G_LST-PARTS (append G_LST-PARTS (list (cons G-SYM-PART G-PART))))
)
(setq G-SYM-PART NIL
G-PART NIL
)
)
)
(ssdel (ssname G-SS 0) G-SS)
)
)
Solved! Go to Solution.