Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

c:BoundaryTagAreaReactor works dynamically in plain ACD but not in MAP

0 REPLIES 0
Reply
Message 1 of 1
mwaychoff
316 Views, 0 Replies

c:BoundaryTagAreaReactor works dynamically in plain ACD but not in MAP

if change a vertex of the resulting closed pline in acad the area tag updates dynamically as expected in acad but NOT in map3d. is there a DLL that my map isntall is missing or something??

 

note1: i am using a DOSlibrary command for placing the tag at the centroid of the closed pline.

note2: this dumbed down version uses your current text style

 

(defun c:BoundaryTagAreaReactor (/ obj centroid vlaobj plinearea fd oba lu)
  (vl-load-com)
  (setvar "tilemode" 1)
  (setvar "OSMODE" 5)
  (setvar "orthomode" 0)
  (setvar "lunits" 4)
  ;;area label should have 2 decimal places
  (setvar "luprec" 2)
  ;;draw pline
  (princ "\nDraw the boundary Pline and make sure to type a 'C' to close when done.")
  (command "._pline")
  ;;wait for pline command to finish
  (while (= 1 (logand (getvar "CMDACTIVE") 1))
    (command PAUSE)
  )
  (setq obj (entlast))

  (setq centroid (dos_plinecentroid obj)) ;from DOSLib1#.arx
  (setq vlaobj (vlax-ename->vla-object obj))
  ;;close pline if it is not closed
  (if (= (vla-get-closed vlaobj) :vlax-false)
    (progn
      ;;it is not closed; close it
      (vla-put-closed vlaobj :vlax-true)
    )
  )
  ;;set pline width
  (command "pedit" obj "w" 4 "")
  ;;calculate area
  (setq plinearea (/ (vla-get-area vlaobj) 144.0))
  ;;create dynamic label
  (setq fd (getvar "fielddisplay"))
  (if (/= fd 0)
    (setvar "fielddisplay" 0)
  )
  (setq oba (vla-get-objectid vlaobj))
  (setq lu (getvar "lunits"))
  (setvar "OSMODE" 0)
  (cond
    ((= lu 2)
     (setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId "
         (rtos oba 2 0)
         ">%).Area \\f \"%lu6%qf1\">%"
        )
     )
    )
    ((= lu 4)
     (setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId "
         (rtos oba 2 0)
         ">%).Area \\f \"%lu2%ct4%qf1 SQ. FT.\">%"
        )
     )
    )
    ((= lu 5)
     (setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId "
         (rtos oba 2 0)
         ">%).Area \\f \"%lu5\">%"
        )
     )
    )
    ((= lu 3)
     (setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId "
         (rtos oba 2 0)
         ">%).Area \\f \"%lu2%ct4%qf1 SQ. FT.\">%"
        )
     )
    )
    ((= lu 1)
     (setq lin (strcat "%<\\AcObjProp Object(%<\\_ObjId "
         (rtos oba 2 0)
         ">%).Area \\f \"%lu1\">%"
        )
     )
    )
  )
  (command "mtext" centroid "J" "MC" "W" "0" lin "")
  (setq plineReactor
  (vlr-object-reactor
    (list vlaobj)
    "pline Reactor"
    '((:vlr-modified . ufa))
  )
  )
  ;;prompt user to move inserted mtext
  (command "move" "l" "" centroid)
  (princ "\nMtext showing area is now anchored to last closed Pline.")
  (princ)
);defun

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost