Nurbs editor
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: Nurbs editor
Hi @microelly2.
Today i had little free time and i have spent it on doing some BOA test. Will give you more feedback tomorrow.
Today i had little free time and i have spent it on doing some BOA test. Will give you more feedback tomorrow.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Nurbs editor
some more useful editor commands
https://youtu.be/rf9NWJkkkbk
https://youtu.be/rf9NWJkkkbk
Re: Nurbs editor
I looked at the video and likely a lot of the things you are exploring will allow you to provide special purpose tools/algorithms in the future. To for example select curve and do some pre-defined operation on it. As most end users would likely get lost if exposed to such detailed control over the curve directly.
As for the example to control points of Draft BSpline from spreadsheet. I will play with that over the weekend. As for the Draft BSpline symmetry. The issue is i guess related to the way it works ATM. For perfect symmetry this i guess would need to work:
But it doesn't as it instead force close the curve in a way the result is not symmetric. What i am guessing we are observing is seam edge would be made at p1 if the result would be extruded and the above example would work without force close.
Anyway if i do something like:
Result is much closer to what i would expect.
As for the example to control points of Draft BSpline from spreadsheet. I will play with that over the weekend. As for the Draft BSpline symmetry. The issue is i guess related to the way it works ATM. For perfect symmetry this i guess would need to work:
Code: Select all
import FreeCAD,Draft
p1 = FreeCAD.Vector(0,0,0)
p2 = FreeCAD.Vector(1,1,0)
p3 = FreeCAD.Vector(0,2,0)
p4 = FreeCAD.Vector(-1,1,0)
Draft.makeBSpline([p1,p2,p3,p4,p1])
Anyway if i do something like:
Code: Select all
import FreeCAD,Draft
p1 = FreeCAD.Vector(0.1,0,0)
p2 = FreeCAD.Vector(1,1,0)
p3 = FreeCAD.Vector(0,2,0)
p4 = FreeCAD.Vector(-1,1,0)
p5 = FreeCAD.Vector(-0.1,0,0)
Draft.makeBSpline([p1,p2,p3,p4,p5])
Re: Nurbs editor
Using Part.BSplineCurve, however, gives a symetric result :
Code: Select all
bs = Part.BSplineCurve()
bs.interpolate(Points = [p1,p2,p3,p4,p1])
Part.show(bs.toShape())
Re: Nurbs editor
Indeed. As for the result:
I guess we achieved G0 continuity at p1 with Part.BSplineCurve? And the Draft.makeBSpline goes after G1 continuity at p1? Now from user point of view i guess i would need to have some sort of continuity tool available to achieve G1 continuity at p1 after i used Part.BSplineCurve and for the Symmetry not to be lost. Like when i use Draft.makeBSpline.
P.S. And from engineering point of view i guess after the G1 continuity at p1 would be achieved p2, p3 and p4 points should stay the same. Therefore i would "sacrifice" precise position of p1 (as closed BSpline with continuity G1 can't be made with such input values) to get G1 continuity at p1 and the rest would stay the same.
I guess we achieved G0 continuity at p1 with Part.BSplineCurve? And the Draft.makeBSpline goes after G1 continuity at p1? Now from user point of view i guess i would need to have some sort of continuity tool available to achieve G1 continuity at p1 after i used Part.BSplineCurve and for the Symmetry not to be lost. Like when i use Draft.makeBSpline.
P.S. And from engineering point of view i guess after the G1 continuity at p1 would be achieved p2, p3 and p4 points should stay the same. Therefore i would "sacrifice" precise position of p1 (as closed BSpline with continuity G1 can't be made with such input values) to get G1 continuity at p1 and the rest would stay the same.
Re: Nurbs editor
You can also control the tangents at each point :
... but you loose symmetry
Wouldn't it be easier to get the symmetry by creating a parametric "symmetric closed curve" composed of a half curve that mirrors itself around its StartPoint-to-EndPoind axis ?
Setting its StartPoint and EndPoint tangents perpendicular to axis, you get not only G1 but Gn continuity ...
Code: Select all
t1 = FreeCAD.Vector(1,0,0)
t2 = FreeCAD.Vector(0,1,0)
t3 = FreeCAD.Vector(-1,0,0)
t4 = FreeCAD.Vector(0,-1,0)
bs.interpolate(Points = [p1,p2,p3,p4,p1], Tangents = [t1,t2,t3,t4,t0], TangentFlags = [True,True,True,True,True])
Wouldn't it be easier to get the symmetry by creating a parametric "symmetric closed curve" composed of a half curve that mirrors itself around its StartPoint-to-EndPoind axis ?
Setting its StartPoint and EndPoint tangents perpendicular to axis, you get not only G1 but Gn continuity ...
Re: Nurbs editor
Will go over it and do more tests tomorrow as for today i don't have the time any more.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Nurbs editor
In this case the result is not a periodic bsplineChris_G wrote:Using Part.BSplineCurve, however, gives a symetric result :
Code: Select all
bs = Part.BSplineCurve() bs.interpolate(Points = [p1,p2,p3,p4,p1]) Part.show(bs.toShape())
to get tangential continuity there is a trick
if there are 3 poles colinear the tangent to the inner pole is the same line.
For interpolation we use a pair of points very close to p1
I have done this (it's not exactly the same but if the tangent vector t is small (under the production tolerenace) it works.)
Code: Select all
p1 = FreeCAD.Vector(0.1,0,0)
p2 = FreeCAD.Vector(1,1,0)
p3 = FreeCAD.Vector(0,2,0)
p4 = FreeCAD.Vector(-1,1,0)
p5 = FreeCAD.Vector(-0.1,0,0)
bs = Part.BSplineCurve()
t=FreeCAD.Vector(0.01,0,0)
bs.interpolate(Points = [p1,p1+t,p2,p3,p4,p1-t,p1])
Part.show(bs.toShape())
Re: Nurbs editor
I wanted to try it but likely it would take me few hours of thinking what exactly was the proposition. Therefore if i would have in-depth knowledge likely yes it could be easier but from the casual FreeCAD user point of view it sounds more like science fiction.Chris_G wrote:Wouldn't it be easier to get the symmetry by creating a parametric "symmetric closed curve" composed of a half curve that mirrors itself around its StartPoint-to-EndPoind axis ?
Setting its StartPoint and EndPoint tangents perpendicular to axis, you get not only G1 but Gn continuity ...
Hi @microelly2.
The result is not symmetric. And i finally tested the BSpline/Spreadsheet "macro". When i try to update the values back to the BSpline the result is:
Code: Select all
TypeError: Either three floats, tuple or Vector expected
By reusing some Points of Draft BSpline. As you can see i don't have to have the same rib geometry and the procedure is straightforward and fast (but it is available only form Python). And if i could have points in spreadsheet i would be able to make 2 points of different BSplines equal and the shape on the image would therefore become fully parametric.
Do you plan to offer any tools that would enable me to achieve better results when applying surfaces?
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Nurbs editor
Have you tested this my script?triplus wrote: The result is not symmetric.
Code: Select all
p1 = FreeCAD.Vector(0.1,0,0)
p2 = FreeCAD.Vector(2,1,0)
p3 = FreeCAD.Vector(0,5,0)
p4 = FreeCAD.Vector(-2,1,0)
p5 = FreeCAD.Vector(-0.1,0,0)
bs = Part.BSplineCurve()
t=FreeCAD.Vector(0.01,0,0)
bs.interpolate(Points = [p1,p1+t,p2,p3,p4,p1-t,p1])
Part.show(bs.toShape())
bs2 = Part.BSplineCurve()
t=FreeCAD.Vector(0.01,0,0)
bs2.interpolate(Points = [p1,p1-t,p4,p3,p2,p1+t,p1])
Part.show(bs2.toShape())
p2=bs2.getPoles()
p2.reverse()
for i,p in enumerate(bs.getPoles()):
print (i,p-p2[i])
..
(0, Vector (0.0, 0.0, 0.0))
(1, Vector (0.0, -4.79420648145934e-19, 0.0))
(2, Vector (-1.4876988529977098e-14, 4.33138767907959e-17, 0.0))
(3, Vector (1.4210854715202004e-14, 0.0, 0.0))
(4, Vector (-7.559437017329307e-15, 2.6645352591003757e-15, 0.0))
(5, Vector (8.43769498715119e-15, 3.3306690738754696e-16, 0.0))
(6, Vector (-7.993605777301127e-15, -5.071355661800947e-17, 0.0))
(7, Vector (0.0, 6.581446000165914e-19, -0.0))
(8, Vector (0.0, 0.0, 0.0))
>>>
where does this error raise?
And i finally tested the BSpline/Spreadsheet "macro". When i try to update the values back to the BSpline the result is:
Code: Select all
TypeError: Either three floats, tuple or Vector expected
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9542 (Git)
Build type: None
Branch: master
Hash: 96dc57c06861922b9dde830e3bcc07e43ed11cf7
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Yes, when we can modify single surfaces in a acceptabel manner then moving, connecting of multiple surfaces should be the next.Do you plan to offer any tools that would enable me to achieve better results when applying surfaces?
This was my testcase
https://freecadbuch.de/doku.php?id=blog ... rmflaechen
So i'm sure that we have methods to bring the pieces together.