Message 1 of 3

Not applicable
05-06-2018
08:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello guys.
I use the following code to insert some blocks into autocad.
the code below inserts using this methodology >> ATT1; 433360,9367221 <<
and works perfectly.
But I would like to add a second attribute >> ATT1; ATT2; 433360,9367221 <<
Does anyone already have a code ready for this?
(defun c:Test (/ T_BlockName T_VarList T_CurValues T_DataFile T_DataFile T_DataLine T_DataFields) (setq T_BlockName "POSTE9_3") (setq T_VarList '("CMDECHO" "OSMODE" "ATTREQ" "ATTDIA")) (setq T_CurValues (mapcar 'getvar T_VarList)) (mapcar 'setvar T_VarList '(0 0 1 0)) (if (and (or (tblsearch "BLOCK" T_BlockName) (setq T_BlockName (findfile (strcat T_BlockName ".dwg"))) ) (setq T_DataFile (getfiled "Select data file" "" "txt" 128)) ) (progn (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-acad-object))) (setq T_DataFileID (open T_DataFile "r")) (while (setq T_DataLine (read-line T_DataFileID)) (if (= (length (setq T_DataFields (String2List T_DataLine ";"))) 2) (vl-cmdf "_.INSERT" T_BlockName (nth 1 T_DataFields) "" "" "" (nth 0 T_DataFields)) ) ) (close T_DataFileID) (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object))) ) (alert " ** Block not found or no data file selected!") ) (mapcar 'setvar T_VarList T_CurValues) (princ) ) (defun String2List (S2L_String S2L_Delimiter / S2L_Return S2L_End S2L_EndPos S2L_Item) (setq S2L_End nil) (while (and (setq S2L_EndPos (vl-string-search S2L_Delimiter S2L_String)) (not S2L_End) ) (if S2L_EndPos (progn (setq S2L_Item (substr S2L_String 1 S2L_EndPos)) (if (/= S2L_Item "") (setq S2L_Return (append S2L_Return (list S2L_Item))) ) (setq S2L_String (substr S2L_String (+ S2L_EndPos 2))) ) (setq S2L_End T) ) ) (if (/= S2L_String "") (setq S2L_Return (append S2L_Return (list S2L_String))) ) S2L_Return )
Solved! Go to Solution.