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
One possibility is to use some conda environment on which you choose all packages on it, or maybe expand an AppImage and run from the expanded directory, (That is a sort of miiniconda environment).
Sadly with Arch Linux you are many time "one step ahead" many program development in terms of update libraries.
This is sometimes difficult to cope with, as sometimes more "stability is needed", but is somewhat an "egg chicken" dilemma.
Regards
Carlo D.
Sadly with Arch Linux you are many time "one step ahead" many program development in terms of update libraries.
This is sometimes difficult to cope with, as sometimes more "stability is needed", but is somewhat an "egg chicken" dilemma.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Curves workbench
Yes, luckily, my main PC is Debian and I don't have to make it work on Manjaro. So, I can wait for the catch-up.onekk wrote: ↑Wed Jan 12, 2022 4:08 pm One possibility is to use some conda environment on which you choose all packages on it, or maybe expand an AppImage and run from the expanded directory, (That is a sort of miiniconda environment).
Sadly with Arch Linux you are many time "one step ahead" many program development in terms of update libraries.
This is sometimes difficult to cope with, as sometimes more "stability is needed", but is somewhat an "egg chicken" dilemma.
Regards
Carlo D.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Curves workbench
You have two distribution, almost at the opposite ends.
Debian is almost conservative and patch heavily upstream sources to adapt them to his Policy
Manjaro (Arch Linux) is very "bleeding edge" and patch upstream sources "less as possible".
Both use systemd so are out of my "personal tastes".
But this is OT here.
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Curves workbench
Yes Pivy, is broken with python 3.10
But I have pushed a fix on monday, that allows Curves WB to load normally, but some tools of the workbench that use pivy will still be broken ...
Re: Curves workbench
Hello Chris_G
A little explanation.
from this line:
and from:
I could guess that with buildFromPolesMultsKnots I could create NURBS curves?
obviously giving weights different from 1.0
according to:
https://en.wikipedia.org/wiki/Non-unifo ... l_B-spline
I could associate mults0 (in this case) to the weight in the page, so what is weights0, that appear to be weights applied to "interpolation points".
Or probably I have not guess the entire argument.
TIA and regards.
Carlo D.
A little explanation.
Code: Select all
poles0 = [Vector (0.0, 0.0, 0.0), Vector (0.16666666666666666, 0.0, 0.20000000794728598), Vector (0.49999999999999994, 0.0, 0.40000001589457196), Vector (0.8333333333333334, 0.0, 0.20000000794728598), Vector (1.0, 0.0, 0.0)]
weights0 = [1.0, 1.0, 1.0, 1.0, 1.0]
knots0 = [0.0, 0.5830951956177974, 1.1661903912355949]
mults0 = [4, 1, 4]
periodic0 = False
degree0 = 3
rational0 = False
bs0 = Part.BSplineCurve()
bs0.buildFromPolesMultsKnots(poles=poles0, mults=mults0, knots=knots0, periodic=periodic0, degree=degree0, weights=weights0, CheckRational=rational0)
obj0 = FreeCAD.ActiveDocument.addObject("Part::Spline","BSplineCurve0")
obj0.Shape = bs0.toShape()
Code: Select all
weights0 = [1.0, 1.0, 1.0, 1.0, 1.0]
Code: Select all
knots0 = [0.0, 0.5830951956177974, 1.1661903912355949]
mults0 = [4, 1, 4]
obviously giving weights different from 1.0
according to:
https://en.wikipedia.org/wiki/Non-unifo ... l_B-spline
I could associate mults0 (in this case) to the weight in the page, so what is weights0, that appear to be weights applied to "interpolation points".
Or probably I have not guess the entire argument.
TIA and regards.
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Curves workbench
Another little question:
I have added some code to the gordon example above:
I have duplicated the some bspline to try to close a shell and create a solid, so I have taken z coordinates and simply negated them, leaving all the other bsplines untouched,
I was expecting that the shell will close, but I'm receiving an error of:
What I'm doing wrong.
TIA and Regards.
Carlo D.
I have added some code to the gordon example above:
Code: Select all
poles6 = [
Vector (0.0, 0.0, 0.0),
Vector (0.16666666666666666, 0.0, -0.20000000794728598),
Vector (0.49999999999999994, 0.0, -0.40000001589457196),
Vector (0.90, 0.0, -0.20000000794728598),
Vector (1.0, 0.0, 0.0)
]
weights6 = [1.0, 1.0, 1.0, 1.0, 1.0]
knots6 = [0.0, 0.5830951956177974, 1.1661903912355949]
mults6 = [4, 1, 4]
bs6 = Part.BSplineCurve()
bs6.buildFromPolesMultsKnots(poles=poles6, mults=mults6, knots=knots6, periodic=False, degree=3, weights=weights6, CheckRational=False)
obj6 = FreeCAD.ActiveDocument.addObject("Part::Spline","BSplineCurve6")
obj6.Shape = bs6.toShape()
poles7 = [
Vector (0.013121589026499694, 0.7915876947955887, -0.0008571221601094414),
Vector (-0.00885599845935274, 0.7914868593215942, -0.40897222572543346),
Vector (0.06419121554803943, 0.7914868593215942, -0.9506049970258048),
Vector (0.4267428298127499, 0.7914868593215942, -0.5416327713003715),
Vector (0.7273027300834656, 0.7914868593215942, 0.0)
]
weights7 = [1.0, 1.0, 1.0, 1.0, 1.0]
knots7 = [0.0, 0.7053976507426758, 1.6396089746603792]
mults7 = [4, 1, 4]
bs7 = Part.BSplineCurve()
bs7.buildFromPolesMultsKnots(poles=poles7, mults=mults7, knots=knots7, periodic=False, degree=3, weights=weights7, CheckRational=False)
bs7.getKnots()
obj7 = FreeCAD.ActiveDocument.addObject("Part::Spline","BSplineCurve7")
obj7.Shape = bs7.toShape(bs7.FirstParameter, bs7.LastParameter)
poles8 = [
Vector (-0.29265061020851135, 1.7891597747802734, 0.0),
Vector (0.556077287533451, 1.7891597747802734, -0.7004100558512543),
Vector (1.2192605936714151, 1.7891597747802732, -0.9304442719319388),
Vector (1.2656674010425126, 1.7891597747802734, -0.23003421608068433),
Vector (1.2394413948059082, 1.7891597747802734, 0.0)]
weights8 = [1.0, 1.0, 1.0, 1.0, 1.0]
knots8 = [0.0, 1.5852100266723423, 2.105837254626154]
mults8 = [4, 1, 4]
bs8 = Part.BSplineCurve()
bs8.buildFromPolesMultsKnots(poles=poles8, mults=mults8, knots=knots8, periodic=False, degree=3, weights=weights8, CheckRational=False)
bs8.getKnots()
obj8 = FreeCAD.ActiveDocument.addObject("Part::Spline","BSplineCurve8")
obj8.Shape = bs8.toShape()
poles9 = [
Vector (0.37568899989128113, 0.0, -0.2814561426639557),
Vector (0.1979298550637957, 0.2528165565557051, -0.5073158012737045),
Vector (0.012426622785748864, 0.8217413994502759, -0.8116662306235015),
Vector (0.25350408566703514, 1.4418752936204768, -0.7220463662761115),
Vector (0.5054633617401123, 1.7891597747802734, -0.5606870651245117)]
weights9 = [1.0, 1.0, 1.0, 1.0, 1.0]
knots9 = [0.0, 0.9339859674161192, 2.0140618136101445]
mults9 = [4, 1, 4]
bs9 = Part.BSplineCurve()
bs9.buildFromPolesMultsKnots(poles=poles9, mults=mults9, knots=knots9, periodic=False, degree=3, weights=weights9, CheckRational=False)
obj9 = FreeCAD.ActiveDocument.addObject("Part::Spline","BSplineCurve9")
obj9.Shape = bs9.toShape()
gordon1 = freecad.Curves.gordon.InterpolateCurveNetwork([bs6,bs7,bs8],[bs3,bs9,bs5],0.1,0.001)
Part.show(gordon1.surface().toShape())
wire1 = Part.Wire((bs6.toShape(), bs0.toShape()))
face1 = Part.Face(wire1)
Part.show(face1, "Face1")
wire2 = Part.Wire((bs2.toShape(), bs8.toShape()))
face2 = Part.Face(wire2)
Part.show(face2, "Face2")
shell = Part.Shell([face1, gordon, face2, gordon1])
Part.show(shell, "Shell")
DOC.recompute()
I was expecting that the shell will close, but I'm receiving an error of:
Code: Select all
shell = Part.Shell([face1, gordon, face2, gordon1])
<class 'Part.OCCError'>: Shape is not a shell
TIA and Regards.
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Curves workbench
The weights are the 'w' coordinates of the poles, in rational BSplines.onekk wrote: ↑Wed Jan 12, 2022 4:52 pm I could guess that with buildFromPolesMultsKnots I could create NURBS curves?
obviously giving weights different from 1.0
according to:
https://en.wikipedia.org/wiki/Non-unifo ... l_B-spline
I could associate mults0 (in this case) to the weight in the page, so what is weights0, that appear to be weights applied to "interpolation points".
Or probably I have not guess the entire argument.
In homogeneous coordinates, the poles are 4D : (x, y, z, w)
So you must always have : len(weights) = len(poles)
The mults are the repetition of the knots.
So you must always have : len(mults) = len(knots).
Most often in Nurbs articles, knots arrays are written WITH knot repetition.
In OpenCascade, the knots are described by 2 arrays : knots (without repetition) and mults.
So, a same BSpline knot sequence would be written either as :
or :knots = [0.0, 0.0, 0.0, 1.0, 2.0, 2.0, 2.0] # Traditional way
knots = [0.0, 1.0, 2.0]
mults = [3, 1, 3] # OCC and FreeCAD way
Re: Curves workbench
Gordon is much better and accurate, so it should be used first.
"Sweep to 2 Rails" should be considered deprecated for now.
This is very old code again (as "Sweep to 2 Rails"), and I wouldn't code it that way now. It would probably need a full refactor.
But I'll consider adding your suggested customization options.
Re: Curves workbench
Hmm...all those great tutorials from MangoJelly deprecated...that's a shame.
Does Gordon really replace approximate points to Nurbs?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Curves workbench
When using the freehand bspline there is the x,y,z axis constraint.
I'm not getting what I'd expect from it...probably because I'm using it wrong.
What is the proper workflow?
Does one hold down the z key while moving vertex? This does not seem to constrain and the cursor flashes at the rate of the key repeat while moving the vertex.
Clicking the vertex, hit z key doesn't seem to constrain.
Instructions please.
I'm not getting what I'd expect from it...probably because I'm using it wrong.
What is the proper workflow?
Does one hold down the z key while moving vertex? This does not seem to constrain and the cursor flashes at the rate of the key repeat while moving the vertex.
Clicking the vertex, hit z key doesn't seem to constrain.
Instructions please.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."