Message 1 of 2
Need help with Dimensions in Autolisp

Not applicable
04-24-2021
09:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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).
(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