I need help on finishing this up. I got yank on to a big project and have tabled this routine. Now that this project is kicking off and the routine is needed in short order. I searched here and there but not all over for some code that I can tear apart but cant seem to find any. I trying to figure out how to pass a field into attribute of block that the routine is inserting.
This is how I am going about (right or wrong).
Thanks
;;; Pass-Area-2-RmTag Lisp
;;;
;;; Purpose = Pulls "Area" Value from User Selected PolyLine
;;; = Inserts new Room Tag Block
;;; = Pass Data from Polyline to new RoomTag Block
;;;
;;; Sub-Functions = None @ this Time
;;;
;;; Revisions = None @ this Time
;;; 2007-05-31 = Ted Krush with a lot help from TheSwamp.org
;;;
;;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(defun c:A2R () ;CE PlineID fieldstring ToRmnaTag)
(princ)
;;; GATHERING OF CURRENT SETTINGS AND PRESETTING VARIABLES AS REQUIRED.
(vl-load-com)
(vl-cmdf ".undo" "m")
(setq ce (getvar "CMDECHO"))
(setvar "CMDECHO" 1)
(setq clay (getvar "clayer"))
(setq atd (getvar "attdia"))
(setvar "attdia" 1)
(setq atr (getvar "attreq"))
(setvar "attreq" 0)
;;;; User Selection of Closed PolyLine and test thereof
(IF (setq ent (entsel "\n Select a closed polyline:"))
; test to see if object was selected
(progn
(setq ent (car ent)) ; test to see if object selcted is a PLine
(if (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
(progn
(setq PlineID (vla-get-objectid
; obtain the object id from the selected
(vlax-ename->vla-object ent)
)
)
)
(prompt "/n Object selected was not a Pline.")
)
)
(prompt "/n No Object was selected.")
)
;;;; Generating of FeildString Variable
;;;; Use the FIELD-command to compose the next line: (itoa PlineID)
(setq fieldstring
(strcat
"%<\\AcObjProp.16.2 Object(%<\\_ObjId "
(itoa PlineID)
">%).Area \\f \"%lu2%pr1%ct8[0.006944444444444444]\">%"
)
)
;;; INSERTS NEW ROOM TAG BLOCK BUT FIRST GETS DIMSCALE AND SET LAYER "RMNA-N" CURRENT
;;; Room Tag Block has 5 Attributes; Name1, Name2, Name3, Number, & SqFt. All will be left blank but SqFt.
(SETQ DSS (GETVAR "DIMSTYLE"))
(VL-CMDF "-DIMSTYLE" "R" DSS)
(SETQ DS (getvar "dimscale"))
(VL-CMDF "-LAYER" "T" "RMNA-N" "M" "RMNA-N" "C" "124" "RMNA-N" "")
(VL-CMDF "-insert" "m:/autoca~1/genera~1/RmTag-SqFt"
"SCALE" DS
"ROTATE" 0.0
pause
)
(SETQ NewRTBlock
(vla-get-objectid
(vlax-ename->vla-object
(ENTLAST)
)
)
)
;;; PASS FIELD TO "SQFT" ATTRIBUTE
;;; RESTORE USERS SET VARIBLES.
(VL-CMDF "LAYER" "S" CLAY "")
(setvar "attreq" atr)
(setvar "attdia" atd)
(setvar "CMDECHO" ce)
(princ)
) ; END OF ROUTINE