Advertisement
ArthurGanem

AG Room Dimensions

Oct 28th, 2017 (edited)
2,987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;|------------------------------|;
  2. ;|  AG Room Dimensions  |;
  3. ;|  www.ArthurGanem.com |;
  4. ;|------------------------------|;
  5.  
  6. ; Command: RMDIM
  7.  
  8. (defun c:rmdim (/ pt1, pt2, pt3, txtpt, horizdist, vertdist, fthorizdist, inhorizdist, ftvertdist, invertdist, txtstr)
  9.  
  10.   (setq pt1 (getpoint "\nClick on the corner of the room            -->"))
  11.   (setq pt2 (getpoint "\nClick on the diagonally opposite corner of the room    -->"))
  12.              
  13.   (setq pt3 (list (car pt1) (cadr pt2) 0.0))
  14.  
  15.   (setq txtpt (getpoint "\nClick where you want to place the label      -->"))
  16.  
  17.   (setq horizdist (distance pt3 pt2))
  18.   (setq vertdist (distance pt1 pt3))
  19.  
  20.   (setq fthorizdist (fix (/ horizdist 12)))
  21.   (setq inhorizdist (fix (rem horizdist 12)))
  22.   (setq ftvertdist (fix (/ vertdist 12)))
  23.   (setq invertdist (fix (rem vertdist 12)))
  24.  
  25.   (setq txtstr (strcat (itoa fthorizdist) "'-" (itoa inhorizdist) "\"x" (itoa ftvertdist) "'-" (itoa invertdist) "\"" ))
  26.  
  27.   (vl-load-com)
  28.  
  29.   (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
  30.  
  31.   (setq txtobj (vla-addtext mspace txtstr (vlax-3d-point txtpt) 4.5))
  32. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement