how to get a point on a curve with specific ratio or distance?

Need help, or want to share a macro? Post here!
silent_missile
Posts: 16
Joined: Mon Jul 29, 2019 11:07 pm

how to get a point on a curve with specific ratio or distance?

Postby silent_missile » Wed Nov 06, 2019 3:29 am

Hello, I have some requirement to use FreeCAD, please help

now I need to get a point on a Part.BSpline

What I know is only the distance ratio from one end, I use help(Part.Curve) to read the comment, but I can't find any function can get a point with specific length ratio.

u parameter is an alternative, but as we all know,in NURBS, points distribution by length doesn't corresponding to the u distribution, there is much variation

I find help(Part.Edge) has a function: paramval = getParameterByLength(pos, [tolerance = 1e-7])

But Part.Curve is different from Part.Edge

actually I'm really confused the difference among Part.Curve, Part.Edge, Part.Line, can any body clarify it?

By the way, is there any way to get a curve from a BSplineSurface with specific u or v?
User avatar
Chris_G
Posts: 1250
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: how to get a point on a curve with specific ratio or distance?

Postby Chris_G » Wed Nov 06, 2019 9:11 am

silent_missile wrote:
Wed Nov 06, 2019 3:29 am
I find help(Part.Edge) has a function: paramval = getParameterByLength(pos, [tolerance = 1e-7])

But Part.Curve is different from Part.Edge
Part.BSplineCurve has parameterAtDistance.

Code: Select all

help(Part.BSplineCurve.parameterAtDistance)
silent_missile wrote:
Wed Nov 06, 2019 3:29 am
actually I'm really confused the difference among Part.Curve, Part.Edge, Part.Line, can any body clarify it?
There are 2 different groups of entities : geometry and topology.
Geometry entities are mathematical objects, like vectors, curves (bspline, bezier, circle, ellipse, line, etc) and surfaces (cone, cylinder, plane, bspline surface, etc)
They are invisible objects.
Part.Curve is the parent class of all the curves.

On the other hand, what you see in the 3D view are topology objects, like vertexes, edges, faces.
Vertexes, edges, faces are created on top of geometry objects.
The parent class of the topology objects is Shape.
There are also some aggregation of these 3 base types, like wires, compounds, shells, solids, compsolids.

Depending on your needs, you will work at the geometry level, or the topology level.
geom_object.toShape() is handy for converting a geometry obj to topology.
The other way, to go from topology to geometry, you would do :

Code: Select all

my_vector = aVertex.Point
my_curve = anEdge.Curve
my_surface = aFace.Surface
silent_missile wrote:
Wed Nov 06, 2019 3:29 am
By the way, is there any way to get a curve from a BSplineSurface with specific u or v?

Code: Select all

my_U_isocurve = aBSplineSurface.uIso(param)
my_V_isocurve = aBSplineSurface.vIso(param)