- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
My company has decided to have the standard keynotes in our drawings match the national cad standards. Our previous standard had a us insert a block that would be exploded and within that would be 2 block(keynote and note blocks) with fields linking the numbers. I have been tasked with automating a way to insert a block and then select an attribute from another block to create a field inside the inserted block. Below is a lisp routine within our library that would allow us to select 2 text/attributes and link the values. I think this is where I should be starting but I don't really know lisp very well and am not sure where to start. I attached an example of what they would like to do.
Any help is greatly appreciated.
(defun c:gcs-MakeField (/ enam elst objid fldexp enm2) (vl-load-com) (while (null (setq enam (car (nentsel "\nSelect TEXT/MTEXT/ATTRIBUTE: ")))) (princ "Nothing Selected") ) (cond ((and (setq elst (entget enam)) (setq elst (member (cdr (assoc 0 elst)) '("ATTRIB" "TEXT" "MTEXT"))) (setq objid (vla-get-ObjectId (vlax-ename->vla-object enam))) (setq fldexp (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa objid) ">%).TextString>%")) (setvar "cmdecho" 0) (progn (If (and (not (= glay "")) (member glay (mapcar 'strcase (cons "MODEL" (layoutlist))))) (setvar 'Ctab glay)) T) (setq enm2 (car (nentsel "\nSelect String: "))) (setq enam (member (cdr (assoc 0 (entget enm2))) '("ATTRIB" "TEXT" "MTEXT"))) (not (vla-put-textstring (vlax-ename->vla-object enm2) fldexp)) (setvar "cmdecho" 1) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport) ) ) ) (vl-some '(lambda (j) (if (null (eval (car j))) (princ (cadr j)) )) '((elst "\nSelected Entity is Not valid for Field value.") (enm2 "\nNothing Selected") (enam "\nSelected Entity is Not valid for Field value.")) ) (princ) )
Solved! Go to Solution.