Bill Tillman Posted August 13, 2015 Share Posted August 13, 2015 I was wondering how one would best and most efficiently create this polyline in lisp. I have achieved it by drawing some lines and then using the FILLET command but the results can be kind of flaky, so I gotta believe there is a better way to do this. Also, I need this to be a polyline, or at least grouped, when it's done so it can me mirrored, copied, etc in other parts of the drawing. Which leads to the question, would it be better to create is as a block then use it when needed. This is again part of the totally automated process I've been working on for what seems like a couple of centuries now so it's got to be done totally by code. No user input or selection is allowed. Quote Link to comment Share on other sites More sharing options...
tombu Posted August 13, 2015 Share Posted August 13, 2015 Why not just make a block out of what you drew and insert it with code? Quote Link to comment Share on other sites More sharing options...
rlx Posted August 13, 2015 Share Posted August 13, 2015 Or just command polyline , LL , UL , UR , LR , then (setvar "FILLETRAD" your-radius) , and finaly use polyline option from fillet command with (entlast) Quote Link to comment Share on other sites More sharing options...
Bill Tillman Posted August 13, 2015 Author Share Posted August 13, 2015 tombu. there will be various sizes of these throughout the drawing so I'm working on a defun which will draw any size, anywhere. Here is what I've got working and it's accurate but I was thinking there might be a better way to do this. I broke the thing into segments using 8 different points, one at the end of each line segment and one for each centerline of the arcs.: ;;; NOTCHES (setq notchcenterline 6 notchwidth 3.25 notchdepth 0.5625 ledgerwidth 0.5 notchrad 0.25 ) (setq np1 (polar (polar pt1 0 (- notchcenterline (/ notchwidth 2.))) a270 ledgerwidth) np2 (polar np1 a90 (+ (- notchdepth notchrad) ledgerwidth)) np3 (polar np2 0 notchrad) np4 (polar np3 a90 notchrad) np5 (polar np4 0 (- notchwidth (* notchrad 2))) np6 (polar np5 a270 notchrad) np7 (polar np6 0 notchrad) np8 (polar np1 0 notchwidth) ) (command "._LINE" np1 np2 "") (setq l1 (entlast)) (command "._LINE" np4 np5 "") (setq l2 (entlast)) (command "._LINE" np7 np8 "") (setq l3 (entlast)) (command "._ARC" "c" np3 np4 np2) (setq a1 (entlast)) (command "._ARC" "c" np6 np7 np5) (setq a2 (entlast)) (command "._PEDIT" l1 "Y" "J" l2 l3 a1 a2 "" "") Quote Link to comment Share on other sites More sharing options...
iconeo Posted August 13, 2015 Share Posted August 13, 2015 I'd just make a dynamic block then. Quote Link to comment Share on other sites More sharing options...
iconeo Posted August 13, 2015 Share Posted August 13, 2015 Maybe something like this? forbill.dwg Lotsa ways to do things in CAD. Cheers. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted August 13, 2015 Share Posted August 13, 2015 You will need add the base point values : [b][color=BLACK]([/color][/b]defun make_lwpline [b][color=FUCHSIA]([/color][/b]x y r[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]entmake [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 0 [color=#2f4f4f]"LWPOLYLINE"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 100 [color=#2f4f4f]"AcDbEntity"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 67 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 410 [color=#2f4f4f]"Model"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"0"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 100 [color=#2f4f4f]"AcDbPolyline"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 90 6[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 70 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 43 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 38 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 39 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list 0 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list 0 [b][color=BLUE]([/color][/b]- y r[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 -0.414214[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list r y[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]- x r[b][color=BLUE])[/color][/b] y[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 -0.414214[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list x [b][color=BLUE]([/color][/b]- y r[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list x 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 210 [b][color=GREEN]([/color][/b]list 0 0 1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq x [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nX Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq y [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nY Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq r [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nFillet Radius Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]make_lwpline x y r[b][color=BLACK])[/color][/b] Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 14, 2015 Share Posted August 14, 2015 My $0.05 you draw the pline as many legs as you want then 2nd order the pline using a global fillet all vertices. The lisp is here somewhere. For various radius using a lisp, 1st rad, line 1 line 2 draw rad prompt using Accept next line or new rad. David a front end for you (if (not AH:getval3)(load "getvals")) (ah:getval3 "Enter height" 5 4 "Enter width" 5 4 "Enter rad" 5 4) ; returns as string val1 val2 val3 GETVALS.zip Quote Link to comment Share on other sites More sharing options...
David Bethel Posted August 14, 2015 Share Posted August 14, 2015 David a front end for you (if (not AH:getval3)(load "getvals")) (ah:getval3 "Enter height" 5 4 "Enter width" 5 4 "Enter rad" 5 4) ; returns as string val1 val2 val3 [ATTACH=CONFIG]55231[/ATTACH] Very kool ! Quote Link to comment Share on other sites More sharing options...
David Bethel Posted August 14, 2015 Share Posted August 14, 2015 Here's how I would add the base point : [b][color=BLACK]([/color][/b]defun make_lwpline [b][color=FUCHSIA]([/color][/b]x y r b / bx by bz[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq bx [b][color=NAVY]([/color][/b]car b[b][color=NAVY])[/color][/b] by [b][color=NAVY]([/color][/b]cadr b[b][color=NAVY])[/color][/b] bz [b][color=NAVY]([/color][/b]caddr b[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]entmake [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 0 [color=#2f4f4f]"LWPOLYLINE"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 100 [color=#2f4f4f]"AcDbEntity"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 410 [color=#2f4f4f]"Model"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 100 [color=#2f4f4f]"AcDbPolyline"[/color][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 90 6[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 70 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 43 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 38 bz[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 39 0[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list bx by[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list bx [b][color=BLUE]([/color][/b]+ by [b][color=RED]([/color][/b]- y r[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 -0.414214[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]+ bx r[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]+ by y[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]+ bx [b][color=RED]([/color][/b]- x r[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]+ by y[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 42 -0.414214[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]+ bx x[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]+ by [b][color=RED]([/color][/b]- y r[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 10 [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]+ bx x[b][color=BLUE])[/color][/b] by[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cons 210 [b][color=GREEN]([/color][/b]list 0 0 1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq x [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nX Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq y [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nY Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 7[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq r [b][color=FUCHSIA]([/color][/b]getdist [color=#2f4f4f]"\nFillet Radius Axis: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]initget 1[b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]setq b [b][color=FUCHSIA]([/color][/b]getpoint [color=#2f4f4f]"\nBase Point: "[/color][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] [b][color=BLACK]([/color][/b]make_lwpline x y r b[b][color=BLACK])[/color][/b] 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.