How to smooth lines using Inventor API?

How to smooth lines using Inventor API?

Anonymous
Not applicable
418 Views
2 Replies
Message 1 of 3

How to smooth lines using Inventor API?

Anonymous
Not applicable

Hello. I'm writing my primitive add-in for Inventor using the Inventor API and C#. I'm interested in the question, how  smooth the joints, where the lines are connected on a sketch, because when i use extruding, it does not look very aesthetically. Thanks for any help.

0 Likes
419 Views
2 Replies
Replies (2)
Message 2 of 3

Xun.Zhang
Alumni
Alumni

Hello,

 

Is your smooth the same as tangent with each other such as make a sketch constraint and G1 or G2 tangent to the start point or end point, if so, how about below sample code?

 

Please refer to API toturial with charper "Sketch Constraints".

 

12.png

 

 

Add tangent constraints to the two lines that join to both ends of the arc.


Call oSketch.GeometricConstraints.AddTangent(oLine(5), oArc)
Call oSketch.GeometricConstraints.AddTangent(oLine(6), oArc)
oApp.ActiveView.Update

 

Thanks!

 


Xun
Message 3 of 3

Anonymous
Not applicable

Thanks for your help. But i think that GeometricConstraints.AddSmooth() method is what i need. I have another queshtion. Inputs for this method - two Entities. I have just massive of lines. If you know, how best to use this method with lines. My code is:

 Point2d [] oCoord= new Point2d [n];
            SketchPoint[] oPoint = new SketchPoint[n];

            for (int i = 0; i < n; i++)
            {
                oCoord[i] = oTG.CreatePoint2d(rx[i], ry[i]);              
            }

            SketchLine[] oLines = new SketchLine[n];

            
            for (int i = 0; i < n; i += krok)
            {
                oPoint[i] = oSketch.SketchPoints.Add(oCoord[i], true);
            }
            int nn = n - (n % 10);
            
            int k = 0;
            for (int i = 0; i < n; i+=10)
            {
                if (i==0) oLines[k]= oSketch.SketchLines.AddByTwoPoints(oCoord[i], oCoord[i + 1]);
                else if (i == nn) oLines[k] = oSketch.SketchLines.AddByTwoPoints(oLines[k - 1].EndSketchPoint, oLines[0].StartSketchPoint);
                else oLines[k] = oSketch.SketchLines.AddByTwoPoints(oLines[k-1].EndSketchPoint, oCoord[i]);
                k++;
            }
0 Likes