I tried to put in an IF statement below but didn't work. Right now, it draws the arcs regardless if out of range. AUTOCAD VBA POLYLINE BULGE CODEPut the Arc segment of code inside an "IF" Statement so if rectangleĭrawn by user is too big or too small, prompt user "Out of range" andĮnd routine. The new addition is working but I would like to be able to do the following: if area of rectangle below 14400 SQ.Inches, give message to redraw rectangle create conditional "if/and" functions based on rectangle area in square inches. Change units from decimal to Architectural (setq convertrecarea (rtos myrecarea 4 2)) converts "convertrecarea" string into architectural format: (setvar "unitmode" 1) units to be displayed as entered (setq myrecarea (* mylength mywidth)) Get area of rectangle (length x width) (setq mylength (distance pt1 pt2)) length Get the four points of rectangle drawn by user above Setting corners of rectangle to variables. (setvar "cmdecho" 1) restore command echo (command "change" Plnwdth "" "p" "LType" "Dashed" "" "ltScale" "30" "") lynetype (command ".linetype" "load" "dashed" "acad.lin" "") (command "pedit" Plnwdth "W" 2 "") set last entity width to 2 (setq Plnwdth (ssget "L")) get last entity (setvar "cmdecho" 0) disable command echo Add width of 2" and dashed line to arc polyline. (cons 010 (trans (list (car p) (cadr q)) 1 z)) (cons 010 (trans (list (car q) (cadr p)) 1 z)) (setq q ((if (zerop (getvar 'worlducs)) getpoint getcorner) p "\nSpecify opposite corner: ")) (if (and (setq p (getpoint "\nSpecify first corner: ")) Here is the working code with the additions above: (defun c:concavearc ( / b p q s z myrecarea convertrecarea pt1 pt2 pt3 pt4 circleset24 circleset36 circleset48) Draw circles and rectangles with a specific size at each corner based on square footage of rectangle in inches. Get area of rectangle by multiplying length by width. I have added to the routine the following steps: A slightly concaved rectangle without user input. Here is what I hope to achieve once a rectangle is drawn by the user. (setq enx (nthmassocsubst (setq i (1 i)) 42 b enx)) My new code to have a previously drawn rectangle above automatically selected. (setq lw (car (entsel "\nPick LWPOLYLINE straight polygon."))) removed original code that has user select a line or rectangle manually. (setq pslst (cons (cons key value) pslst) tst t) (if (equal (assoc key (member (nth j slst) slst)) (nth j slst) 1e-6) (setq plst (cons (nth (setq j (1 j)) lst) plst)) (setq k (length (setq slst (member (assoc key lst) lst)))) (defun nthmassocsubst ( n key value lst / k slst p j plst m tst pslst ) (setq myrec (command "rectangle" pt1 pt3 "")) (setq pt3 (getcorner pt1 "\nEnter cross corner: ")) (setq pt1 (getpoint "\nEnter first corner: ")) My added code to draw a rectangle by the user picking two opposite corners. (defun c:lwstraight2arced ( / nthmassocsubst lw enx vs gr enxb p b i pt1 pt2 pt3 pt4 myrec ) AUTOCAD VBA POLYLINE BULGE HOW TOPull mouse negative Y direction = concave (which is what I want).ĭoes anyone know how to add code to automatically pull in the negative Y direction about 10 degrees once rectangle is selected? Is there an easier way to accomplish this task by just making 10 degree arcs instead of lines when drawing a rectangle? Code to convert rectangle lines into arcs: Push mouse positive Y direction = convex. I found this wonderful routine written by Marko Ribar (sorry if that's not correct credit) that does exactly what I'm looking for, except that the user has to manually define direction and degree of the arcs using the mouse. I am wanting to automatically convert all sides of a rectangle drawn by the user into concave arcs (about 10 degrees all around).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |