Mugna101 Posted April 18, 2023 Share Posted April 18, 2023 Hello everybody! ive been meddling around with lisp trying to create a code that will draw lines on a predetermined grid of points (in order to draw a window or a door etc) now the grid is made out of a set of points with letters for the Y pos and numbers for the X pos. its all fine and dadny and its working great but it looks very ugly on script.. every point is made out of calculating the ratios given by the user for X and Y points, then converting it to a string. (setq qx (nth 0 pt1)) (setq qy (nth 1 pt1)) (setq A1 (strcat (rtos qx 2 2) "," (rtos qy 2 2) )) (setq B1 (strcat (rtos qx 2 2) "," (rtos (+ qy (nth 0 spcs))) )) (setq C1 (strcat (rtos qx 2 2) "," (rtos (+ qy (nth 1 spcs))) )) (setq D1 (strcat (rtos qx 2 2) "," (rtos (+ qy (nth 2 spcs))) )) (setq E1 (strcat (rtos qx 2 2) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F1 (strcat (rtos qx 2 2) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G1 (strcat (rtos qx 2 2) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H1 (strcat (rtos qx 2 2) "," (rtos (+ qy h_1)) )) (setq A2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos qy 2 2) )) (setq B2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H2 (strcat (rtos (+ qx (nth 0 spcs))) "," (rtos (+ qy h_1)) )) (setq A3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos qy 2 2) )) (setq B3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H3 (strcat (rtos (+ qx (nth 1 spcs))) "," (rtos (+ qy h_1)) )) (setq A4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos qy 2 2) )) (setq B4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H4 (strcat (rtos (+ qx (nth 2 spcs))) "," (rtos (+ qy h_1)) )) (setq A5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos qy 2 2) )) (setq B5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H5 (strcat (rtos (+ qx (- (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy h_1)) )) (setq A6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos qy 2 2) )) (setq B6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H6 (strcat (rtos (+ qx (- (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy h_1)) )) (setq A7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos qy 2 2) )) (setq B7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H7 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 3 spcs)))) "," (rtos (+ qy h_1)) )) (setq A8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos qy 2 2) )) (setq B8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H8 (strcat (rtos (+ qx (+ (/ w_1 2) (nth 4 spcs)))) "," (rtos (+ qy h_1)) )) (setq A9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos qy 2 2) )) (setq B9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H9 (strcat (rtos (+ qx (- w_1 (nth 2 spcs)))) "," (rtos (+ qy h_1)) )) (setq A10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos qy 2 2) )) (setq B10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H10 (strcat (rtos (+ qx (- w_1 (nth 1 spcs)))) "," (rtos (+ qy h_1)) )) (setq A11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos qy 2 2) )) (setq B11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (nth 0 spcs))) )) (setq C11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (nth 1 spcs))) )) (setq D11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (nth 2 spcs))) )) (setq E11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H11 (strcat (rtos (+ qx (- w_1 (nth 0 spcs)))) "," (rtos (+ qy h_1)) )) (setq A12 (strcat (rtos (+ qx w_1)) "," (rtos qy 2 2) )) (setq B12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (nth 0 spcs))) )) (setq C12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (nth 1 spcs))) )) (setq D12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (nth 2 spcs))) )) (setq E12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (- h_1 (nth 2 spcs)))) )) (setq F12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (- h_1 (nth 1 spcs)))) )) (setq G12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy (- h_1 (nth 0 spcs)))) )) (setq H12 (strcat (rtos (+ qx w_1)) "," (rtos (+ qy h_1)) )) in order to write it down i used google sheets and concatenated it with a table for easy copy pasting again im super glad it works and i didnt get any issues with it.. but all im asking for is a better way of writing it all. it was exhausting.. thnx in advance! love this forum Quote Link to comment Share on other sites More sharing options...
devitg Posted April 18, 2023 Share Posted April 18, 2023 42 minutes ago, Mugna101 said: (nth 0 spcs) @Mugna101 please state SPCS , it shall be a List . Quote Link to comment Share on other sites More sharing options...
devitg Posted April 18, 2023 Share Posted April 18, 2023 50 minutes ago, Mugna101 said: w_1 state Please upload as attached the whole LSP you are dealing . and the sample DWG Quote Link to comment Share on other sites More sharing options...
Mugna101 Posted April 19, 2023 Author Share Posted April 19, 2023 (edited) 3 hours ago, devitg said: its a whole lot of script with almost nothing relating to this. w_1 and h_1 are height and width that the user prompts,with spcs which is a list of numbers they determine the spaces between the spots of the grid. using polylines in different combinations creates different shapes. right now it is very very POC idea :~D Edited April 19, 2023 by Mugna101 Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 19, 2023 Share Posted April 19, 2023 Make dynamic blocks alot less work to get what you want. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 19, 2023 Share Posted April 19, 2023 (edited) Like mhupp I have pick inside wall left side how far from corner, then enter all the values and a window is drawn the wall is broken as the dwg is 2 1/2D. Happy to discuss the "Package" not free, but cheap. Forgot to mention enter distance offset or Mid as a default. Edited April 19, 2023 by BIGAL Quote Link to comment Share on other sites More sharing options...
Mugna101 Posted April 19, 2023 Author Share Posted April 19, 2023 11 hours ago, mhupp said: Make dynamic blocks alot less work to get what you want. Ive been attempting this first with the dynamic blocks but there are some issues im having there.. making a simple lisp to repetatively do something a block is a bit too limited for (i think) 8 hours ago, BIGAL said: Like mhupp I have pick inside wall left side how far from corner, then enter all the values and a window is drawn the wall is broken as the dwg is 2 1/2D. Happy to discuss the "Package" not free, but cheap. Forgot to mention enter distance offset or Mid as a default. im wondering why the 3d frame wont sit on the plan correctly... are you using lisp for it? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 20, 2023 Share Posted April 20, 2023 (edited) The frame was drawn over a PDF as an exercise to show how to draw with Plan & Elevation views, using layouts and mview can look at all the elevations as roof is part of package. It was a demonstration for a potential client. The software draws in a plan view but creates a more 3d model as it goes. AS walls have a height, windows and doors remove wall sections when added. PM me if want more information. Edited April 20, 2023 by BIGAL 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.