Hải_Duy Posted August 19, 2023 Share Posted August 19, 2023 hi i am looking for lisp that shows length x width like this drawing i have been looking for similar lisps but they are not working the way i want, can someone help me to create such a lisp Drawing2.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2023 Share Posted August 19, 2023 Did you Google ? Try "label pline sides Autocad lisp" big hint look for a version by Kent Cooper no need to write code. 1 Quote Link to comment Share on other sites More sharing options...
thecocuk07 Posted August 22, 2023 Share Posted August 22, 2023 On 8/19/2023 at 5:30 AM, Hải_Duy said: hi i am looking for lisp that shows length x width like this drawing i have been looking for similar lisps but they are not working the way i want, can someone help me to create such a lisp Drawing2.dwg 40.5 kB · 2 downloads Kent Cooper , thank you https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/length-and-width-of-rectangle-as-text/td-p/1369617 (Defun C:PLWH ; = PolyLine Width x Height [overall extent from bounding box] (/ plss n plobj LL UR delta) (setvar "dimzin" 0) (if (setq plss (ssget '((0 . "*POLYLINE")))) (repeat (setq n (sslength plss)) (setq plobj (vlax-ename->vla-object (ssname plss (setq n (1- n))))) (vla-getBoundingBox plobj 'minpt 'maxpt) (setq LL (vlax-safearray->list minpt) UR (vlax-safearray->list maxpt) delta (mapcar '- UR LL) ); setq (command "_.text" "_c" ; [spelling out "_center" is taken as Osnap call] "_none" (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2) ); mapcar "" 0 ; accept default height, rotation 0 (strcat (rtos (car delta) 2 3) " x " (rtos (cadr delta) 2 3)); first line of Text ); command ); repeat ); if (princ) ); defun Quote Link to comment Share on other sites More sharing options...
Hải_Duy Posted August 23, 2023 Author Share Posted August 23, 2023 13 hours ago, thecocuk07 said: Kent Cooper , thank you https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/length-and-width-of-rectangle-as-text/td-p/1369617 (Defun C:PLWH ; = PolyLine Width x Height [overall extent from bounding box] (/ plss n plobj LL UR delta) (setvar "dimzin" 0) (if (setq plss (ssget '((0 . "*POLYLINE")))) (repeat (setq n (sslength plss)) (setq plobj (vlax-ename->vla-object (ssname plss (setq n (1- n))))) (vla-getBoundingBox plobj 'minpt 'maxpt) (setq LL (vlax-safearray->list minpt) UR (vlax-safearray->list maxpt) delta (mapcar '- UR LL) ); setq (command "_.text" "_c" ; [spelling out "_center" is taken as Osnap call] "_none" (mapcar '/ (mapcar '+ (vlax-safearray->list minpt) (vlax-safearray->list maxpt)) '(2 2 2) ); mapcar "" 0 ; accept default height, rotation 0 (strcat (rtos (car delta) 2 3) " x " (rtos (cadr delta) 2 3)); first line of Text ); command ); repeat ); if (princ) ); defun this is this lisp, i found it yesterday 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.