Macro to draw folding lines on a loft
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Macro to draw folding lines on a loft
@mm2107 still have a look at:
https://wiki.freecad.org/Macro_Cut_Line
On some things, it works great.
https://wiki.freecad.org/Macro_Cut_Line
On some things, it works great.
Re: Macro to draw folding lines on a loft
Yes, I checked it out, it uses the `discretize` function in order to cut edges, that's what I'm also usingjfc4120 wrote: ↑Tue Mar 14, 2023 11:22 pm @mm2107 still have a look at:
https://wiki.freecad.org/Macro_Cut_Line
On some things, it works great.
Re: Macro to draw folding lines on a loft
I sent you another PM for a program to check out, see images here:
It lays out the first section of an elbow, but select only a 2 piece it will give a pipe miter. In inches but just tweak to mm.
It lays out the first section of an elbow, but select only a 2 piece it will give a pipe miter. In inches but just tweak to mm.
- Attachments
-
- elbow2.png (35.4 KiB) Viewed 899 times
-
- elbow.png (8.14 KiB) Viewed 899 times
Re: Macro to draw folding lines on a loft
Nice one !
Mh I'm going nowhere with simple vectors comparison when I try to form the folding lines. Maybe simply manipulating vertexes isn't enough, and I should start to consider the surface which could exist between the two sketches (i.e. the loft), and try to see if I could make some polygons on this surface which are developable (i.e. gauss curvature == 0.0, as EdWilliams mentioned). To sum sup, start considering the surface of the loft ... I should read more about surfaces, because I don't know a lot about them.
Mh I'm going nowhere with simple vectors comparison when I try to form the folding lines. Maybe simply manipulating vertexes isn't enough, and I should start to consider the surface which could exist between the two sketches (i.e. the loft), and try to see if I could make some polygons on this surface which are developable (i.e. gauss curvature == 0.0, as EdWilliams mentioned). To sum sup, start considering the surface of the loft ... I should read more about surfaces, because I don't know a lot about them.
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Macro to draw folding lines on a loft
Creating a developable (ruled) surface between curves (assuming it is possible):
If curve1 is X1= X1(u1) and curve2 is X2 = X2(u2) then the rule lines connect points such that the tangent vectors dX1/du1 and dX2/du2 are coplanar with the line between the points X2(u2) - X1(u1).
or (X2(u2) - X1(u1)).dot(dX1/du1 .cross(dX2/du2) )=0
Solving this for u2 given u1 creates the ruling. I have this working numerically in the generalized cone thread. It reduced the Gaussian Curvature of my test surface by 10^5, so I take it as flat.
Supposedly for cubic splines, the equation to be solved is a quartic, so soluble algebraically. I have not pursued this.
If curve1 is X1= X1(u1) and curve2 is X2 = X2(u2) then the rule lines connect points such that the tangent vectors dX1/du1 and dX2/du2 are coplanar with the line between the points X2(u2) - X1(u1).
or (X2(u2) - X1(u1)).dot(dX1/du1 .cross(dX2/du2) )=0
Solving this for u2 given u1 creates the ruling. I have this working numerically in the generalized cone thread. It reduced the Gaussian Curvature of my test surface by 10^5, so I take it as flat.
Supposedly for cubic splines, the equation to be solved is a quartic, so soluble algebraically. I have not pursued this.
Re: Macro to draw folding lines on a loft
Interesting reading here : https://www.researchgate.net/publicatio ... Guidelines
Also https://arxiv.org/pdf/2212.06589.pdf
Also https://arxiv.org/pdf/2212.06589.pdf
Re: Macro to draw folding lines on a loft
Regarding the links I posted above, and your message EdWilliams, I managed to try an implementation of the vector's triple product. The result looks interesting, I have to figure out why some folding lines are placed inside the shape tho (maybe because of tangent vector orientation ?)
Code at https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro (still messy because of WIP)
Code at https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro (still messy because of WIP)
Re: Macro to draw folding lines on a loft
Indeed, it was because of the tangent direction ^^
The result is much better now :
cf commit https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro
EDIT commit https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro has a better fix
The result is much better now :
cf commit https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro
EDIT commit https://github.com/nm2107/FreeCADLoftFo ... es.FCMacro has a better fix
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Macro to draw folding lines on a loft
That is working nicely! Have you tried an oloid? viewtopic.php?style=4&p=659487#p659487 and containing thread.
Your first reference was good - but they weren't to clear about the piecewise part. Lofting between two convex curves is algorithmically straight-forward. If they have concave bits with multiple solutions for the generators, it's harder to untangle.
Your first reference was good - but they weren't to clear about the piecewise part. Lofting between two convex curves is algorithmically straight-forward. If they have concave bits with multiple solutions for the generators, it's harder to untangle.
Re: Macro to draw folding lines on a loft
@nm2107 Do you have the code worked out for parts at an angle yet? Like image:
- Attachments
-
- ob_cut.png (2.52 KiB) Viewed 626 times