Advertisement
ArthurGanem

Room Dimensions AutoLisp

Jan 10th, 2023
2,094
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;|------------------------------|;
  2. ;|    AG Door Dimensions        |;
  3. ;|    www.LetsBIMtogether.com   |;
  4. ;|------------------------------|;
  5.  
  6.  
  7. ; Command: RMDM
  8.  
  9.  
  10. (prompt "\nLoaded AG Room Dimensions!")
  11.  
  12. ;; Round  -  Lee Mac <3
  13. ;; Rounds 'n' to the nearest integer
  14. (defun LM:round ( n )
  15.     (fix (+ n (if (minusp n) -0.5 0.5)))
  16. )
  17.  
  18.  
  19. (prompt "\nLoaded AG Room Dimensions!")
  20.  
  21.  
  22. (defun c:rmdm (/ pt1, pt2, pt3, txtpt, horizdist, vertdist, fthorizdist, inhorizdist, ftvertdist, invertdist, txtstr)
  23.  
  24.   (setq pt1 (getpoint "\nClick on the corner of the room            -->"))
  25.   (setq pt2 (getpoint "\nClick on the diagonally opposite corner of the room    -->"))
  26.              
  27.   (setq pt3 (list (car pt1) (cadr pt2) 0.0))
  28.  
  29.   (setq txtpt (getpoint "\nClick where you want to place the label      -->"))
  30.  
  31.   (setq horizdist (abs (distance pt3 pt2)))
  32.   (setq vertdist (abs (distance pt1 pt3)))
  33.  
  34.   (setq fthorizdist (fix (/ horizdist 12)))
  35.   (setq inhorizdist (LM:round (rem horizdist 12)))
  36.   (setq ftvertdist (fix (/ vertdist 12)))
  37.   (setq invertdist (LM:round (rem vertdist 12)))
  38.  
  39.   (setq txtstr (strcat (itoa fthorizdist) "'-" (itoa inhorizdist) "\"x" (itoa ftvertdist) "'-" (itoa invertdist) "\"" ))
  40.  
  41.   (vl-load-com)
  42.  
  43.   (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
  44.  
  45.   (setq txtobj (vla-addtext mspace txtstr (vlax-3d-point txtpt) 9)) ; <-- TEXT HEIGHT HERE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement