Need help with Dimensions in Autolisp

Need help with Dimensions in Autolisp

Anonymous
Not applicable
483 Views
1 Reply
Message 1 of 2

Need help with Dimensions in Autolisp

Anonymous
Not applicable

I need help with dimensioning of points in a while loop but not able to figure out how to do it. So basically  I need to dimension from "P1" to "ox1" and "ox1" to "ox1"( till the loop ends) and lastly "ox1" to "P2" (Ref image to visualize the points).  

 

naveedfn047_0-1619281167771.png

(defun c:se (/ orgin l w P1 P2 P3 P4 Line1 Line2 Line3 Line4)
  (setq orgin (getpoint "pick point")
	      ycrd(cadr orgin) ;y co-ordinate
        xcrd(car orgin) ;x co-ordinate
  )
     
  (setq len ( getdist "Length")); converts distances to work with co-ordinates
  (setq wid ( getdist "Width")); converts distances to work with co-ordinates
  
  (setq l (+ len xcrd)) ;adds length to the x co-ordinate
  (setq w (+ wid ycrd)) ;adds width to the y co-ordinate
  
  (setq xdiv( getreal "# opening in X axis")) ;collects info for number of division in x axis 

  (setq P1 (list xcrd ycrd 0))
  (setq P2 (list l ycrd 0))
  (setq P3 (list xcrd w 0))
  (setq P4 (list l w 0)) ;points of the rectangle

  (setq Line1(entmake(list(cons 0 "LINE")(cons 10 P1)(cons 11 P2)(cons 8 "Purlin"))))
  (setq Line2(entmake(list(cons 0 "LINE")(cons 10 P2)(cons 11 P4)(cons 8 "Purlin"))))
  (setq Line3(entmake(list(cons 0 "LINE")(cons 10 P4)(cons 11 P3)(cons 8 "Purlin"))))
  (setq Line4(entmake(list(cons 0 "LINE")(cons 10 P3)(cons 11 P1)(cons 8 "Purlin"))));creates rectangle
  
  
  (setq xcdis(/ len xdiv)) ;gets measurement of each division in x axis which remains constant 
  (setq xdis(/ len xdiv))  ;gets measurement of each division in x axis which changes according to the loop
  


	(while (< xdis len)
      (setq xcrddis(+ xcrd xdis));gives x co-ordinates for each division in relation to the orgin point
  		(setq ox1 (list xcrddis ycrd 0)) ;base point of the line
  		(setq ox2 (list xcrddis w 0)) ;top point of the line
  		(setq Linex(entmake(list(cons 0 "LINE")(cons 10 ox1)(cons 11 ox2)(cons 8 "Beams"))))
  		(setq xdis(+ xdis xcdis)) ; adds the length of each divsion to the variable for the next loop 
	  );while loop to draw line for each division in x-axis

 

0 Likes
484 Views
1 Reply
Reply (1)
Message 2 of 2

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... I need to dimension from "P1" to "ox1" and "ox1" to "ox1"( till the loop ends) and lastly "ox1" to "P2" ....  


Will QDIM do what you want?

Kent Cooper, AIA