TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Lupo76 on October 04, 2019, 09:35:47 AM

Title: Alternative to the FILLET command in vlisp
Post by: Lupo76 on October 04, 2019, 09:35:47 AM
Hello to all,
I am using the following line of code to fillet all the vertices of a polyline

Code: [Select]
(command "_.fillet" "_r" DIA "_.fillet" "_p" oggpoli)

unfortunately in my context with the reactos it doesn't work because I can't use the "command" function.
Is there a way to use fillet without "command" and without "vl-cmdf"?

Thank you in ancient times
Title: Re: Alternative to the FILLET command in vlisp
Post by: Augusto on October 04, 2019, 10:08:01 AM
Maybe Lee-Mac can help you with this task.

http://lee-mac.com/bulgeconversion.html
Title: Re: Alternative to the FILLET command in vlisp
Post by: Master_Shake on October 04, 2019, 10:19:57 AM
Are you trying to automagically create filleted entities? Simply replace the XX with your units of radius.

Source here (https://www.reddit.com/r/AutoCAD/comments/8xra30/can_poly_lines_automatically_be_filleted_to_a/?st=k1c7rrhr&sh=bfaa2e30)

Code - Auto/Visual Lisp: [Select]
  1. (defun C:PLF ()
  2.   (command "_PLINE")
  3.   (while (= 1 (getvar "cmdactive"))
  4.     (command pause))
  5.   (vl-cmdf "._FILLET" "P" "R" [b]XX[/b] "L")
  6.   (princ)
  7. )
  8.  
Title: Re: Alternative to the FILLET command in vlisp
Post by: Lupo76 on October 04, 2019, 11:24:30 AM
Are you trying to automagically create filleted entities? Simply replace the XX with your units of radius.

Source here (https://www.reddit.com/r/AutoCAD/comments/8xra30/can_poly_lines_automatically_be_filleted_to_a/?st=k1c7rrhr&sh=bfaa2e30)

Code - Auto/Visual Lisp: [Select]
  1. (defun C:PLF ()
  2.   (command "_PLINE")
  3.   (while (= 1 (getvar "cmdactive"))
  4.     (command pause))
  5.   (vl-cmdf "._FILLET" "P" "R" [b]XX[/b] "L")
  6.   (princ)
  7. )
  8.  

As I wrote I can't use "command" and "vl-cmdf" in my context with reactors....
Title: Re: Alternative to the FILLET command in vlisp
Post by: Lupo76 on October 04, 2019, 11:27:29 AM
Maybe Lee-Mac can help you with this task.

http://lee-mac.com/bulgeconversion.html

mmmmmm....I don't understand how it can be useful to solve my problem.
I look for a vlisp function that without using "command" converts the sharp edges of a polyline to arcs.
Title: Re: Alternative to the FILLET command in vlisp
Post by: Lee Mac on October 04, 2019, 01:14:10 PM
Is there a way to use fillet without "command" and without "vl-cmdf"?

You will need to write your own fillet command (https://www.cadtutor.net/forum/topic/57095-polyline-bulge/?tab=comments#comment-473134)...
Title: Re: Alternative to the FILLET command in vlisp
Post by: BIGAL on October 05, 2019, 09:11:11 PM
As Lee says and he helped me you can write a direct command to the command line I have Circle fillet and offset.

eg f123 will start fillet command and set radius to 123 the radius can be any value, a c100 is a circle of 100 radius.

It uses a reactor and checks what error has occurred as if you type c45 it will return unknown command c45.

The method is limited to say 26 plus say ten individual versions as it looks at 1st character of the error.

Title: Re: Alternative to the FILLET command in vlisp
Post by: lamarn on October 06, 2019, 04:55:55 PM
The code is not working

VLA-OBJECT nil

shouldn't obj be defined in the first few lines?
Title: Re: Alternative to the FILLET command in vlisp
Post by: BIGAL on October 06, 2019, 09:39:05 PM
 Sorry as I cut this out of a bigger routine I left in a couple of redundant lines. I have updated the code above.

Note as it uses reactors you can not use a decimal point in the values but there is a work around 45-6 is = 45.6 just use the "-" for a decimal.
Title: Re: Alternative to the FILLET command in vlisp
Post by: Dlanor on October 07, 2019, 03:01:40 AM
If you think of a polyline as a road alignment and filleting with a radius as inserting a curve between straight road sections with a given radius, the problem becomes

calculate delta angle
calculate tangent lengths
calculate chord points : tangent to curve = distance to IP - tan length and curve to tangent distance to IP + tan length. (vlax-curve-getpointatdist)
delete ip (old vertex)
insert new vertices (chord points)
calculate bulge and apply at TC

https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Civil3D-UserGuide/files/GUID-0B06FB2D-945F-4526-89D8-07820E78FF6C-htm.html (https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Civil3D-UserGuide/files/GUID-0B06FB2D-945F-4526-89D8-07820E78FF6C-htm.html)
Title: Re: Alternative to the FILLET command in vlisp
Post by: Master_Shake on October 08, 2019, 10:33:41 AM
Are you trying to automagically create filleted entities? Simply replace the XX with your units of radius.

Source here (https://www.reddit.com/r/AutoCAD/comments/8xra30/can_poly_lines_automatically_be_filleted_to_a/?st=k1c7rrhr&sh=bfaa2e30)

Code - Auto/Visual Lisp: [Select]
  1. (defun C:PLF ()
  2.   (command "_PLINE")
  3.   (while (= 1 (getvar "cmdactive"))
  4.     (command pause))
  5.   (vl-cmdf "._FILLET" "P" "R" [b]XX[/b] "L")
  6.   (princ)
  7. )
  8.  

As I wrote I can't use "command" and "vl-cmdf" in my context with reactors....

So what is your context? What are you trying to accomplish? What is your end goal?