Grrr Posted November 19, 2015 Share Posted November 19, 2015 Hello guys, I'm looking for a lisp routine that creates boundary pline and inserts area field refered to that pline. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 19, 2015 Share Posted November 19, 2015 (edited) 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 November 19, 2015 by Tharwat Quote Link to comment Share on other sites More sharing options...
Grrr Posted November 19, 2015 Author Share Posted November 19, 2015 Worked perfectly! Just a little request: Could you set the justification of the field to "middle center"? Thank you! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 19, 2015 Share Posted November 19, 2015 You are welcome. Sure it is possible , codes above updated. Quote Link to comment Share on other sites More sharing options...
Grrr Posted November 19, 2015 Author Share Posted November 19, 2015 Thank you again, I find this lisp very useful! Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 19, 2015 Share Posted November 19, 2015 Thank you again, I find this lisp very useful! You are welcome and I just added to my ToolBox. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.