Changing the "FILLET" radius of a polyline

Changing the "FILLET" radius of a polyline

youssefGC
Advocate Advocate
997 Views
7 Replies
Message 1 of 8

Changing the "FILLET" radius of a polyline

youssefGC
Advocate
Advocate

Hello Forums,

 

I am working on a function that allows modifying the fillet radius between two segments of a polyline. For instance, if the current radius is 120 (image 1), we want to change it to a value of 250 (image 3).

So, initially, my idea is to transform the polyline into one with broken lines (no fillet / image 2) and then apply "FILLET" with the new radius value.

1.png

2.png

3.png

The problem I found is in the evaluation of the intersection vertex (point A in the photo).

4.png

 

Thank you.

 

 

0 Likes
Accepted solutions (2)
998 Views
7 Replies
Replies (7)
Message 2 of 8

ActivistInvestor
Mentor
Mentor
Accepted solution

You can use Polyline.GetLineSegment2dAt() to get the two adjacent line segments and then call IntersectWith() to find the point you need.

0 Likes
Message 3 of 8

youssefGC
Advocate
Advocate

Thank you for the reply.

In my understanding, using "Polyline.GetLineSegment2dAt()" allows retrieving a line segment for a given starting index, and the endpoint is the next point in the polyline. If I apply this to retrieve both segments (I) and (II), I cannot perform the intersection since both segments require an extension.

1.png

 

0 Likes
Message 4 of 8

ActivistInvestor
Mentor
Mentor

You can create two instances of the Line2d class from the endpoints of the 2 line segments, and intersect those.

0 Likes
Message 5 of 8

youssefGC
Advocate
Advocate
Accepted solution

I made a mistake in the second argument of the "IntersectWith" method. Instead of using "Intersect.ExtendBoth," I had used "OnBothOperands." Here is an excerpt of the corrected code that works well for me:

for (int i = 1; i < tempPline.NumberOfVertices-1; i++)
                {

                    if (tempPline.GetBulgeAt(i)!=0)
                    {
                        Line L1 = new Line(tempPline.GetPoint3dAt(i-1), tempPline.GetPoint3dAt(i));
                        Line L2 = new Line(tempPline.GetPoint3dAt(i+1), tempPline.GetPoint3dAt(i+2));

                        Point3dCollection intPoints = new Point3dCollection();
                        L1.IntersectWith(L2, Intersect.ExtendBoth, intPoints, IntPtr.Zero, IntPtr.Zero);

                        if (intPoints.Count>0)
                        {
                            lstPts.Add(intPoints[0]); // Add to list
                        }
                    }

                }

 

0 Likes
Message 6 of 8

ActivistInvestor
Mentor
Mentor

Except that your code is creating new database objects and not disposing them or adding them to a database.

 

It also relies on an assumption that the polylines start and end with line segments rather than arc segments.

0 Likes
Message 7 of 8

youssefGC
Advocate
Advocate

The overall program precisely deletes the old polyline and adds the new one at the end.

The starting point is always a line (bulge = 0). I forgot to mention this detail in the original post.

 

0 Likes
Message 8 of 8

ActivistInvestor
Mentor
Mentor

I was referring to the two line entities that your code creates:

 

Line L1 = new Line(tempPline.GetPoint3dAt(i-1), tempPline.GetPoint3dAt(i));
Line L2 = new Line(tempPline.GetPoint3dAt(i+1), tempPline.GetPoint3dAt(i+2));