Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
jarredmonday
Posts: 108
Registered: ‎08-29-2012
Message 1 of 4 (863 Views)
Accepted Solution

Polyline width and fillet Lisp help. Please.

863 Views, 3 Replies
02-05-2013 10:53 AM

Hello,

 

I'm sure this is a topic discussed often, but I'm having a hard time finding it.

 

I've been searching on and off all morning for a lisp routine, without any luck. I'm trying to draw a pline with a pre determined width (5") and be able to draw unlimited line segments then automatically fillet with a pre determined radius (5").

 

I wrote this generic macro: ^C^CPLINEWID;5;PL;\\\\;FILLET;R;5;F;P;LAST;  to save SOME time but I want unlimited line segments. Can this be modified or would a lisp be the better route to go?

 

Thank you very much,

Jarred

Please mark Accept as Solution if your question is answered. Kudos gladly accepted. ⇘

jarredmonday wrote:

.... I'm trying to draw a pline with a pre determined width (5") and be able to draw unlimited line segments then automatically fillet with a pre determined radius (5").

 

I wrote this generic macro: ^C^CPLINEWID;5;PL;\\\\;FILLET;R;5;F;P;LAST;  to save SOME time but I want unlimited line segments. Can this be modified or would a lisp be the better route to go?

....


I don't think there's a way to allow for unlimited input in a macro, but you can do it in a Lisp routine.  This seems to do that:

(defun C:PL5F5 (/ plw filr); = PolyLine 5 wide, Filleted at 5 radius
(setq plw (getvar 'plinewid) filr (getvar 'filletrad))
(setvar 'plinewid 5)
(setvar 'filletrad 5)
(command "_.pline")
(while (> (getvar 'cmdactive) 0); allows unlimited input    (command pause)
); while
(command "_.fillet" "_polyline" (entlast))
(setvar 'plinewid plw)
(setvar 'filletrad filr)
); defun

EDIT:  You could make it generic, calling for User input of the global width and the filleting radius, if you want:

 

(defun C:smileytongue:LGF (/ plw filr)
; = PolyLine, Global width, Filleted at all corners
  (setq plw (getvar 'plinewid) filr (getvar 'filletrad))
  (setvar 'plinewid (getdist "\nPolyline global width: "))
  (setvar 'filletrad (getdist "\nCorner fillet radius: "))

  (command "_.pline")
  (while (> (getvar 'cmdactive) 0); allows unlimited input

    (command pause)
  ); while
  (command "_.fillet" "_polyline" (entlast))
  (setvar 'plinewid plw)
  (setvar 'filletrad filr)
); defun

 

[I tried putting that in a code window, as with the first one, to eliminate the smiley possibility, but somehow when I changed those parts to red, it split them out and broke up the rest as three separate code windows around them, which for some inexplicable reason it didn't do with the blue comment in the first one.  So if you see a smiley at the beginning because this version isn't in a code window, it's a colon followed by a P as in the one inside the code window, assuming that the first one is properly not showing the smiley, at which it used to fail last summer, but supposedly it's now fixed.  I don't like code windows, and as far as I can tell, the prevention of smileys is about the only benefit they provide.  Sign in and get into your Settings, where you can disable smileys entirely, and you won't have a problem either way.]

*Expert Elite*
Kent1Cooper
Posts: 5,513
Registered: ‎09-13-2004
Message 2 of 4 (856 Views)

Re: Polyline width and fillet Lisp help. Please.

02-05-2013 11:37 AM in reply to: jarredmonday

jarredmonday wrote:

.... I'm trying to draw a pline with a pre determined width (5") and be able to draw unlimited line segments then automatically fillet with a pre determined radius (5").

 

I wrote this generic macro: ^C^CPLINEWID;5;PL;\\\\;FILLET;R;5;F;P;LAST;  to save SOME time but I want unlimited line segments. Can this be modified or would a lisp be the better route to go?

....


I don't think there's a way to allow for unlimited input in a macro, but you can do it in a Lisp routine.  This seems to do that:

(defun C:PL5F5 (/ plw filr); = PolyLine 5 wide, Filleted at 5 radius
  (setq plw (getvar 'plinewid) filr (getvar 'filletrad))
  (setvar 'plinewid 5)
  (setvar 'filletrad 5)
  (command "_.pline")
  (while (> (getvar 'cmdactive) 0); allows unlimited input    (command pause)
  ); while
  (command "_.fillet" "_polyline" (entlast))
  (setvar 'plinewid plw)
  (setvar 'filletrad filr)
); defun

EDIT:  You could make it generic, calling for User input of the global width and the filleting radius, if you want:

 

(defun C:smileytongue:LGF (/ plw filr)
; = PolyLine, Global width, Filleted at all corners
  (setq plw (getvar 'plinewid) filr (getvar 'filletrad))
  (setvar 'plinewid (getdist "\nPolyline global width: "))
  (setvar 'filletrad (getdist "\nCorner fillet radius: "))

  (command "_.pline")
  (while (> (getvar 'cmdactive) 0); allows unlimited input

    (command pause)
  ); while
  (command "_.fillet" "_polyline" (entlast))
  (setvar 'plinewid plw)
  (setvar 'filletrad filr)
); defun

 

[I tried putting that in a code window, as with the first one, to eliminate the smiley possibility, but somehow when I changed those parts to red, it split them out and broke up the rest as three separate code windows around them, which for some inexplicable reason it didn't do with the blue comment in the first one.  So if you see a smiley at the beginning because this version isn't in a code window, it's a colon followed by a P as in the one inside the code window, assuming that the first one is properly not showing the smiley, at which it used to fail last summer, but supposedly it's now fixed.  I don't like code windows, and as far as I can tell, the prevention of smileys is about the only benefit they provide.  Sign in and get into your Settings, where you can disable smileys entirely, and you won't have a problem either way.]

Kent Cooper
Distinguished Contributor
jarredmonday
Posts: 108
Registered: ‎08-29-2012
Message 3 of 4 (841 Views)

Re: Polyline width and fillet Lisp help. Please.

02-05-2013 12:15 PM in reply to: Kent1Cooper

Thank you very much. This is perfect! Exactly what I have been needing.

Please mark Accept as Solution if your question is answered. Kudos gladly accepted. ⇘
*Expert Elite*
Kent1Cooper
Posts: 5,513
Registered: ‎09-13-2004
Message 4 of 4 (831 Views)

Re: Polyline width and fillet Lisp help. Please.

02-05-2013 12:51 PM in reply to: jarredmonday

jarredmonday wrote:

Thank you very much. This is perfect! Exactly what I have been needing.


You're welcome.  The routines were easy compared to the problems I had fighting with the Code windows, which gave me some more ammunition to gripe about them further in the "Expert Elite Lounge."  I hope those problems can be overcome, but unless and until I find out that they have been, I don't think I'll use code windows again.

Kent Cooper
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.