I would like to understand, if possible, why 3 out of 4 of these surfaces are valid. (3 out 4 counting around the, not the bottom and two circles.)
Curves workbench
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: Curves workbench
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Curves workbench
using parametric curve.
...
maybe one day this macro will be embedded in Curves Wb?
...
maybe one day this macro will be embedded in Curves Wb?
- Attachments
-
- sinus.FCStd
- (25.17 KiB) Downloaded 21 times
-
- Capture.JPG (17.98 KiB) Viewed 1321 times
Re: Curves workbench
My goal is obtain periodic b-spline whiout matematics and parametric.
I can control and maybe can obtain the correct tangency of the first-last knot with parameter "t" (tangent to currant view, I aply with lateral right view)vin edit mode and it apears correct. But there are some other parameter of the knot that controls other things that I not have access.
I can control and maybe can obtain the correct tangency of the first-last knot with parameter "t" (tangent to currant view, I aply with lateral right view)vin edit mode and it apears correct. But there are some other parameter of the knot that controls other things that I not have access.
Re: Curves workbench
... i/insert and s/snap work good,
but t/tangent doesn't
and activating p/periodic destroys it
but t/tangent doesn't
and activating p/periodic destroys it
- Attachments
-
- pBSpl_2.PNG (29.07 KiB) Viewed 1248 times
-
- pBSpl_2.FCStd
- FC.20.1
- (12.73 KiB) Downloaded 21 times
Re: Curves workbench
A screen captures and file.
1 the original curve
2 After apply periodic
3 Side view
4 Apply tangent with view direction (if wrong tangent, try the other side), see the curve symmetry seems correct on these side.
5 result, the tangency appear seems correct, but definitely not.
1 the original curve
2 After apply periodic
3 Side view
4 Apply tangent with view direction (if wrong tangent, try the other side), see the curve symmetry seems correct on these side.
5 result, the tangency appear seems correct, but definitely not.
- Attachments
-
- knot_problem.FCStd
- (12.6 KiB) Downloaded 25 times
Re: Curves workbench
I have found a workaround.
Select the vertexes you want to interpolate and run the following script :
Code: Select all
"""Part.BSplineCurve.interpolate() doesn't generate fully periodic curves.
The start/end point has a multiplicity 2 while inner points have a multiplicity 1.
This macro is a workaround.
It duplicates the points we want to interpolate, in order to generate a multi-turn curve
and extracts a one turn BSpline curve in the middle.
"""
import FreeCAD
import FreeCADGui
import Part
def parameterization(points, fac, force_closed=False):
# Computes a knot Sequence for a set of points
# fac (0-1) : parameterization factor
# fac=0 -> Uniform / fac=0.5 -> Centripetal / fac=1.0 -> Chord-Length
pts = points[:]
if force_closed and pts[0].distanceToPoint(pts[-1]) > 1e-7: # we need to add the first point as the end point
pts.append(pts[0])
params = [0]
for i in range(1, len(pts)):
p = pts[i] - pts[i - 1]
if isinstance(p, FreeCAD.Vector):
le = p.Length
else:
le = p.length()
pl = pow(le, fac)
params.append(params[-1] + pl)
return params
# get the selected vertexes
vl = []
sel = Gui.Selection.getSelectionEx()
for so in sel:
svl = []
for sub in so.SubObjects:
if isinstance(sub, Part.Vertex):
svl.append(sub)
if svl:
vl.extend(svl)
svl = []
else:
vl.extend(so.Object.Shape.Vertexes)
# extend the list of points
pts = [v.Point for v in vl]
nbp = len(pts)
n = 1
if nbp <= 4:
n = 2
npts = pts
npts.extend(pts * (2 * n))
nbnp = len(npts)
# interpolate the extended list of points
bs = Part.BSplineCurve()
print(len(npts))
pars = parameterization(npts, 0.5, True)
print(len(npts))
print(len(pars))
bs.interpolate(Points=npts, Parameters=pars, PeriodicFlag=True)
# extract a one turn BSpline curve in the middle
offset = n * nbp
npoles = bs.getPoles()[offset:-offset - 1]
nmults = bs.getMultiplicities()[offset:-offset]
nknots = bs.getKnots()[offset:-offset]
nbs = Part.BSplineCurve()
nbs.buildFromPolesMultsKnots(npoles, nmults, nknots, True, 3)
Part.show(nbs.toShape())
Re: Curves workbench
Thank you to make the script.
The scrips works very well !!, but loses the parametric essence.
In the he curve workbench I can attach the curve knots to vertex that I can manipulate. To adjust the curve shape.
Re: Curves workbench
Chris_G, many thanks for your help, patience and response to my problem.
Final result (full parametric).
Final result (full parametric).
- Attachments
-
- b-spline periodic.FCStd
- (834.85 KiB) Downloaded 33 times
Re: Curves workbench
... I still have problems applying tangency at the "periodic_point".
The space curve is not fully symmetric.
Using a brute force design, to fix the "knot point" gives still some kind of distortion.
The mathematical curve is exact (parametric only by means of geometric construction ??)
The space curve is not fully symmetric.
Using a brute force design, to fix the "knot point" gives still some kind of distortion.
The mathematical curve is exact (parametric only by means of geometric construction ??)
- Attachments
-
- pBSpl.FCStd
- FC.20.1
- (115.7 KiB) Downloaded 28 times