I am not very familiar with blocks which has attributes and I guess i need some help in the area from the gurus here.
I created a dwg "gridcross.dwg" which has 2 attributes "N" and "S".
I trying to write a lisp program to insert this block but it gives me an error "Automation Error. Key not found"
My code is as follows :-
(defun AGD_Cal ()
(setq GB:acadobj (vlax-get-acad-object)
;; acad Object
GB:ActivedocumentObj (vla-get-Activedocument GB:acadobj)
;;
;; IAcadDocument Object
;;
;; the current dwg
;;
;; IAcadModelspace Collection
;;
GB:mSpace (vla-get-ModelSpace GB:ActivedocumentObj)
;; the modelspace collection
)
(if (not (tblsearch "block" "GRIDCROSS"))
(progn
(setq blkref (vlax-invoke-method GB:mSpace 'insertblock
(vlax-3d-point '(0.0 0.0 0.0))
"C:/GOH-LISP/DWG04-NEW/GRIDCROSS.DWG" 1.0 1.0 1.0 0.0))
(setq atts (vlax-invoke blkref 'getattributes))
(foreach att atts
(if (eq (vla-get-tagstring att) "S")
(vla-put-textstring att "S")
(vla-put-textstring att "N")
)
);foreach
)
);IF
);end
Also, how can I rewrite such that when i insert the gridcross blcok, it does not prompt me for the values?
thank you in advance