CKLMLL95 Posted April 3, 2019 Share Posted April 3, 2019 I am drawing buildings that use panels. I may draw a rectangle that is 10' long and 3/4" wide. I need a lisp routine using rectangle. I need point to point, straight line defines distance, and able to define the width of the rectangle needed. Thanks Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 3, 2019 Share Posted April 3, 2019 (edited) (defun c:RectLeftSide (/ a p1 p2 p3 p4 w wS) (princ "\n c:RectOr : V : 1 . 04 . 2019 .") (setq pi2 (/ pi 2.)) (while (and (setq p1 (getPoint "\n FIRST Corner : < Pick > ; < Enter = STOP > : ")) (setq p2 (getPoint p1 "\n SECOND Corner : < Pick > ; < Enter = STOP > : ")) (setq wS (getString "\n WIDE : < Enter = STOP > : ")) ) (progn (setq w (AtoF wS) a (angle p1 p2) p3 (polar p2 (+ a pi2) w) p4 (polar p1 (+ a pi2) w) ) ;;; (command "_.pLine" p1 p2 p3 p4 "c") (entMake (list '(0 . "LwPolyLine") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(8 . "0") '(62 . 256) '(90 . 4) '(70 . 1) '(38 . 0) (cons 10 p1) '(40 . 0) '(41 . 0) (cons 10 p2) (cons 10 p3) (cons 10 p4) )) )) ; w (princ "\n c:RectOr : E N D .") (princ) ) 1 . Try this . 2 . Or do you want to divide the length into segments of 10' x 3/4" ? 3 . Maybe you need to Hatch the rectangles too . Edited April 3, 2019 by Costinbos77 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 4, 2019 Share Posted April 4, 2019 What about what is left if you have 33 then thats 3x10 plus a 3 do you want a bim as well so at end you get how many 10 and all the odds as a part list ? Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 4, 2019 Share Posted April 4, 2019 (edited) Try this : (defun c:RectLeftSide (/ a ai d di hSi hAi hNi l o p1 p2 p3 p4 pE w wS) ; Globale : l w lR (princ "\n c:RectOr : V : 1 . 04 . 2019 .") (setVar "CmdEcho" 0) (if (numberP l) T (setq l 10.)) ; if (if (numberP w) T (setq w 3.)) ; if (if (= (type lR) 'Str) T (setq lR "Rectangle")) ; if (setq coL (getString (strCat "\n LENGTH : < Enter = " (RtoS l 2 4) " > : ")) pi2 (/ pi 2.) osm (getVar "osMode") hNi (getVar "hpName") hSi (getVar "hpScale") hAi (getVar "hpAng") ) (command "_.Layer" "_N" "Rectangle,Hatch" "_C" 1 "Rectangle" "_C" 8 "Hatch" "") (setVar "hpName" "ANSI31") (setVar "hpScale" 4) (setVar "hpAng" 0) (while (and (setq p1 (getPoint "\n START Point : < Pick > ; < Enter = STOP > : ")) (setq pE (getPoint p1 "\n END Point : < Pick > ; < Enter = STOP > : ")) (setq a (angle p1 pE) d (distance p1 pE) wS (getString (strCat "\n WIDE : < Enter = " (RtoS w 2 4) " > : "))) ) (setVar "osMode" 0) (if (= wS "") T (setq w (AtoF wS) ) ) ; if (while (equal (setq ai (angle p1 pE)) a 0.0001) ;(= (setq ai (angle p1 pE)) a) (setq di (distance p1 pE) p2 (polar p1 a (if (>= di l) l di)) p3 (polar p2 (+ a pi2) w) p4 (polar p1 (+ a pi2) w) ) ;;; (command "_.pLine" p1 p2 p3 p4 "c") (setq o (entMakeX (list '(0 . "LwPolyLine") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 8 lR) '(62 . 256) '(90 . 4) '(70 . 1) '(38 . 0) (cons 10 p1) '(40 . 0) '(41 . 0) (cons 10 p2) (cons 10 p3) (cons 10 p4) )) ) (command "_.Zoom" "_O" o "" "_.bHatch" "_S" o "" "") ; "_.Text" "_M" pp hTextM 0 txt) ; end of c (setq p1 p2) ) ; w ) ; w (setVar "hpName" hNi) (setVar "hpScale" hSi) (setVar "hpAng" hAi) (setVar "osMode" osm) (setVar "CmdEcho" 1) (princ "\n c:RectOr : E N D .") (princ) ) Edited April 4, 2019 by Costinbos77 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 5, 2019 Share Posted April 5, 2019 A couple of suggestions. One of the quick ways to make multiple rectangs and hatch is to use array you only need set snapang to the angle of the 2 pick points. Create only 1 rectang and hatch using last. Not sure why you are using getstring for entry of a real value. I have a little library defun that checks if layer exists handy when you run multiple times. Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 5, 2019 Share Posted April 5, 2019 Hello BigAl , 1 . my first intention was to define a dynamic block with L=10 and Wide = variable Stretch . But I was thinking CKLMLL95 can do that without any help ( Google or YouTube are around ) . Array command ? Good idea ! That is another story . I am not sure if CKLMLL95 will prefer one hatch instead of individual hatches . But I can see we are more interested in this then the initiator himself . 2 . Quote Not sure why you are using getstring for entry of a real value. Because I am lazy and I like to use Enter = "" to approve an existing Value . Maybe initGet can do something like this , somehow . 3. Quote I have a little library defun that checks if layer exists handy when you run multiple times. How or where can we see this library ? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 5, 2019 Share Posted April 5, 2019 You can add the color and linetype in the call as well by changing the make layer. (defun ahlaycheck ( lay / ) (if(not(tblsearch "LAYER" lay)) (command "_.-layer" "_m" lay "") ) ) This is my initget see multi radio button.lsp you could add cancel as an exit. Multi radio buttons.lsp Multi GETVALS.lsp Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 7, 2019 Share Posted April 7, 2019 Thank you very much Mr. BigAl . Are very great ideas , as a proper programmer ! If you can send an example for function AH:GetValsM , how the argument list DCLlst looks for 3 choices ? And for (AH:Butts AHdef verHor butLst) as well , will be great ! Thanks in advance . Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 8, 2019 Share Posted April 8, 2019 (edited) Inside Multi getvals and Multi radio buttons is example code. Basicly you can have as many lines of input as you like the entry box size is individually sized for each entry. It does though return a list of strings, the limit of lines may be screen size etc I have set entry limit to 145 characters and seemed ok. ; (if (not AH:getvalsm)(load "Multi Getvals.lsp")) ; (setq ans (AH:getvalsm (list "This is heading" "Line 1" 5 4 "11" "Line2" 8 7 "22" "Line3" 8 7 "33" "Line4" 8 7 "4"))) ; ; (if (not AH:getvalsm)(load "Multi Getvals.lsp")) ; (setq newvals (AH:getvalsm (list "Cross fall percent" "Enter Horizontal scale " 5 4 "100" "Enter Vertical scale" 5 4 "50" "Enter number of decimal places" 5 4 "2"))) ; note the values are strings ; (if (not AH:getvalsm)(load "Multi Getvals.lsp")) ; (setq newvals (AH:getvalsm (list "Percent required " "Enter % " 5 4 "100")) In the radio buttons the verhor is "V" or "H" for vertical or horizontal. Edited April 8, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 9, 2019 Share Posted April 9, 2019 (edited) Thank you very much Mr. BigAl ! If you can reveal for us the consistency of (AH :Butts AHdef verHor butLst) will be great ! Thanks in advance ! Edited April 11, 2019 by Costinbos77 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 10, 2019 Share Posted April 10, 2019 (edited) Not sure what you mean by consistency. I made Multi button to replace initget, Multi getvals was created where you need to input values anywhere from 1 line to 14 the limit is a dcl thing. You just see so much code that ask line after line input. Your eyes have to go to the bottom of the screen and you can set default values. Ther results are strings but thats easy to make real or integer. You visually see all your value before pressing OK so mistakes are reduced. Edited April 10, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
Costinbos77 Posted April 11, 2019 Share Posted April 11, 2019 Hello Mr. BigAl . If you can reveal to us the arguments of AH :Butts , will be great. AHdef = ? verHor = H or V ; butLst = ? As you don it for AH:getvalsm . Thank you very much. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 12, 2019 Share Posted April 12, 2019 (edited) This is sort of hijacking the post. I am happy for administrator to create a new post. "Library Multi button and Multi line input dcl's" Will try to explain more then. Edited April 12, 2019 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.