Jump to content

BPOLY with AREA Field


Grrr

Recommended Posts

Have a play with this program and let me know.

 

(defun c:test (/ doc e o u spc reg obj mt p)
 ;;    Tharwat 19.11.2015    ;;;
 (setq e (entlast))
 (if (and (vl-cmdf "_.-boundary" "\\" "\\")
          (setq o (entlast))
          (not (eq e o))
          (eq (cdr (assoc 0 (entget o))) "LWPOLYLINE")
     )
   (progn
     (setq doc (vla-get-activedocument (vlax-get-acad-object))
           spc (vla-get-block
                 (vla-item (vla-get-layouts doc) (getvar 'ctab))
               )
           reg (vlax-invoke
                 spc
                 'addregion
                 (list (setq obj (vlax-ename->vla-object o)))
               )
     )

     (if (setq
           p  (vlax-3d-point
                (append (vlax-get (car reg) 'centroid) (list 0.))
              )
           mt (vla-addmtext
                spc
                p
                0.0
                (strcat
                  "%<\\AcObjProp Object(%<\\_ObjId "
                  (if (vlax-method-applicable-p
                        (setq
                          u (vla-get-utility
                              doc
                            )
                        )
                        'getobjectidstring
                      )
                    (vla-getobjectidstring u obj :vlax-false)
                    (itoa (vla-get-objectid obj))
                  )
                  ">%).Area \\f \"%lu6%qf1\">%"
                )
              )
         )
       (progn
         (vla-put-attachmentpoint mt acmiddlecenter)
         (vla-move mt (vla-get-insertionpoint mt) p)
       )
     )
     (vla-delete (car reg))
   )
 )
 (princ)
)
(vl-load-com)

Edited by Tharwat
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...