Macro to Fillet Polyline

  • Here is a routine that will fillet all the corners of a polyline.
    • The key point is that the line must be a polyline. 
    • Use the "combine" command to take one of your tubing runs and turn it into one continuous polyline. 
    • The routine ignores the first and last points of the line.
  • This routine has a couple of "error" checks to ensure that lines are selected.
  • It is interesting to note that one can "combine" the resulting filleted polyline to see what it's length is . . .

    Submitted by: prl
'fillet a polyline routine
dim rx(1000), ry(1000), s1x(1000), s1y(1000), s2x(1000), s2y(1000)

sys(80)=0

SetPoint "Select polyline to fillet . . .", 1
pointval x y z 1
>PointSelect
{
<Type 0
<pointxyz [x, y, z]
}

Getselect 1, entid
entity entid

if sys(90) <> 1 then
message "Entity selected is not a polyline"
sys(80)=0
sys(1)=0
end
endif

pointcount = sys(1)

if pointcount = 2 then
message "Line entity only has two points, can't apply fillet"
sys(80)=0
sys(1)=0
end
endif

input "Enter fillet radius", bend$
rad = val(bend$)

sys(36)=1 'run silent
sys(80)=0

for j = 1 to pointcount
pointval rx(j), ry(j), z1 j
next j
sys(1)= 0

sc = 0
for j = 2 to pointcount-1
sc = sc + 1
s1x(sc) = (rx(j)+rx(j-1))/2
s1y(sc) = (ry(j)+ry(j-1))/2

s2x(sc) = (rx(j+1)+rx(j))/2
s2y(sc) = (ry(j+1)+ry(j))/2
next j


for j = 1 to sc
>Fillet
{

<Type 0
<Radius [rad]
<pointxyz [s1x(j), s1y(j), 0]
<pointxyz [s2x(j), s2y(j), 0]
}
next j

end

File to Download:

filletpolyline.bsc