Curves workbench

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
adrianinsaval
Posts: 344
Joined: Thu Apr 05, 2018 5:15 pm

Re: Curves workbench

Postby adrianinsaval » Mon Apr 27, 2020 11:03 pm

Zolko wrote:
Mon Apr 27, 2020 6:21 pm
Wouldn't it be more practical to use the built-in makeOffset2D function rather than making a function to calculate for every point? Or is this a workaround to some limitation it has?
User avatar
Zolko
Posts: 994
Joined: Mon Dec 17, 2018 10:02 am

Re: Curves workbench

Postby Zolko » Mon Apr 27, 2020 11:54 pm

adrianinsaval wrote:
Mon Apr 27, 2020 11:03 pm
the built-in makeOffset2D function rather than making a function to calculate for every point? Or is this a workaround to some limitation it has?
It doesn't work. Either "result is null" or it crashes. Or there is a magic setting that I didn't find. And it doesn't produce a sketch. And if I make an offset and use Draft.makeSketch to convert it to a sketch, it doesn't put the resulting sketch in the correct location.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
carlopav
Posts: 1537
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Curves workbench

Postby carlopav » Tue Apr 28, 2020 6:18 am

Zolko wrote:
Mon Apr 27, 2020 6:21 pm
I made this tool for very specific cases
Nice tool, perhaps we can integrate it also in the Draft_Offset object? It really lacks some proper curve offset features...

(I tried you tool for Draft_BezCurve and Draft_BSpline, but it seems to just produce a straight lines wire, probably it's not aimed at those objects)
follow my experiments on BIM modelling for architecture design
User avatar
Zolko
Posts: 994
Joined: Mon Dec 17, 2018 10:02 am

Re: Curves workbench

Postby Zolko » Tue Apr 28, 2020 7:48 am

carlopav wrote:
Tue Apr 28, 2020 6:18 am
Zolko wrote:
Mon Apr 27, 2020 6:21 pm
I made this tool for very specific cases
Nice tool, perhaps we can integrate it also in the Draft_Offset object? It really lacks some proper curve offset features...
yes, please do. Actually, the part where the wire is transformed into a sketch comes from Draft.makeSketch, but that function produces a sketch that is correctly oriented as the initial wire, but offset. The treatment of the final placement is probably wrong.

EDIT: I did try Draft_Offset but it doesn't work on my wires:

Code: Select all

>>> Gui.runCommand('Draft_Offset',0)
>>> import Draft
>>> Draft.offset(FreeCAD.ActiveDocument.Section002,FreeCAD.Vector(0.1568655751835033, -0.07142428553050592, -2.995044534353171),copy=True,occ=False)
Report view:

Code: Select all

Pick distance
ToDo.doTasks, Unexpected error:
<class 'AttributeError'>
in ['Draft.offset(FreeCAD.ActiveDocument.Section002,FreeCAD.Vector(0.1568655751835033, -0.07142428553050592, -2.995044534353171),copy=True,occ=False)', 'FreeCAD.ActiveDocument.recompute()']

(I tried you tool for Draft_BezCurve and Draft_BSpline, but it seems to just produce a straight lines wire, probably it's not aimed at those objects)
no, it only does polylines. But it is on purpose, because when you intersect a plane with a warped extrusion, and even if both ends are made with polylines, the section is made up of small BSplines, and that calculation takes a lot of time. This is what I had tried at the beginning, with Draft.makeArray, but it was too slow (probably more accurate but unusably slow)

As I said, this is very specific to a particular use-case, but this particular use-case is something many hobby RC-hobbyists need.
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Chris_G
Posts: 1423
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Curves workbench

Postby Chris_G » Tue Apr 28, 2020 8:59 am

I don't understand what is not working with existing offset tools.
Would you have a sample file to do some tests ?
User avatar
Zolko
Posts: 994
Joined: Mon Dec 17, 2018 10:02 am

Re: Curves workbench

Postby Zolko » Tue Apr 28, 2020 10:13 am

Chris_G wrote:
Tue Apr 28, 2020 8:59 am
I don't understand what is not working with existing offset tools.
Would you have a sample file to do some tests ?
Attached. It's a Part.Extrusion between 2 standard RG15 airfoil sections, imported with the AirfoilImportAndScale macro. They're oriented along XZ and offset and twisted (as a wing should be). It is then cut with a plane done again as a Part.Extrusion along some angles, and both Part.Extrusions intersect with a Part.Section to produce the desired Section, the white line. It's this section – which is planar and in 3D – that I want to offset in its plane.

Draft_Offset.png
Draft_Offset.png (596.88 KiB) Viewed 393 times

When I do that in Draft_Offset I get the following error:

Code: Select all

Pick distance
ToDo.doTasks, Unexpected error:
<class 'AttributeError'>
in ['Draft.offset(FreeCAD.ActiveDocument.Section,FreeCAD.Vector(-0.79842002489893, -0.4493481558184617, 0.40076389396119433),copy=True,occ=False)', 'FreeCAD.ActiveDocument.recompute()']

Also, when you convert the Section to a sketch with Draft, the resulting sketch is in the wrong 3D position.


EDIT: oups, forgot:

OS: Ubuntu 18.04.3 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20655 (Git) AppImage
Build type: Release
Branch: master
Hash: e8e67e8c5ebbc9f9ed9ea67aba5b891969595ece
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United Kingdom (en_GB)
Attachments
Wing_RG15.FCStd
(233.14 KiB) Downloaded 8 times
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Zolko
Posts: 994
Joined: Mon Dec 17, 2018 10:02 am

Re: Curves workbench

Postby Zolko » Tue Apr 28, 2020 2:27 pm

Zolko wrote:
Mon Apr 27, 2020 6:21 pm
I've made a very specific tool that I really needed and couldn't find in the Curves workbench: it allows to offset 3D curves that are planar, in their own plane. The very specific use-case is to make ribs in aircraft wings. The resulting curve can be either a 3D wire (Part.line) or a sketch. It is not perfect, it's quite brute-force, but should be good enough for many people. It can't handle curves, only poly-lines.
here a somewhat improved version, with some more error-checking. I can understand that it is not very useful outside the very specific use-case as described. With the icon.
Attachments
offset3DCurve.svg
(3.26 KiB) Downloaded 15 times
offset3DCurve.FCMacro
(10.9 KiB) Downloaded 10 times
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
touvenant
Posts: 13
Joined: Fri Jul 12, 2019 7:37 am

Re: Curves workbench

Postby touvenant » Fri May 29, 2020 2:42 pm

Chris_G wrote:
Tue Dec 12, 2017 2:43 pm
Hi,
The goal of this tool is to create a support face ( for a sketch object ) that stays clamped to 2 rail curves.
Let's say I want to create a parametric arched-top guitar shape between the white and orange Sketcher curves :
ProfileSupport-1.jpg


- I go Top-View (View Direction is used as the direction of the support face) and I select the 2 rail curves, by clicking them where I want the Support face to be
- I activate the tool and I get this support face that is parametric and can be moved along the input curves with the Parameters properties :

ProfileSupport-2.jpg


- Now, I can use the top edge of the support face as an external geometry line in a sketch, and constraint my BSpline curve ends to this line.

ProfileSupport-3.jpg
ProfileSupport-4.jpg


- Finally, I can build a surface with the boundary curves and the profile sketches as "unbound edge" constraint curves.
This surface is fully parametric and can be stretched and modified by editing the sketches.

ProfileSupport-5.jpg
hammax wrote:
Tue Dec 12, 2017 2:00 pm
Next question: is there a possibility to change fontsize and fontcolour in your Info-HUD-Feature.
I already could change it per hack inside 1.Icon-Tool (Bspline) .py-Macro.
In HUD there are at least two places, where fontproperties are defined. But here my hack-trials didn't succeed.
( I need a bigger font and a bright colour , because I have a darkblue Background, like Catia)
For the "BSpline curve" tool ???
This tool is fairly broken, I should remove it.
But you can modify the appearance of the HUD on line 54 of "bezierCurve.py" :

Code: Select all

self.Block1.setFont("Sans", 10.0, (0.,0.,0.))
#Function arguments are (FontName, Size,  Color)
Windows 7 (64) + FreeCAD 0.18

Hello everybody,
after import 3 draws.jpg on 3 planes spaces :
1 On a first sketch, x,y plane, I draw livet profile, top view, with B-Spline tool.
2 On a second sketch, y,z plane, I draw livet profile, side view, with B-Spline tool.
3 with this two B-Spline, curve 3D is create with "CombinedProjectionCurve"
4 On a new sketch, the keel is create with "B-Spline" and the stem is create with "Line" with a space betwen twice
5 I clic "BlendCurve" with this B-Spline and Line selected, so it's create the rounded forward
6 I Delete stem
7 Select keel and BlendCurve and clic on "JoinCurve"
8 Now, that's two rails can be applied with "RuledSurface" (It's work but i dont want do this yet)
9 Select the two rails and clic on "SupportPlane" (It's work) but when I create a new sketch and I try to select the support plane, that's don't work sa mère...
Thanks for your help
Après avoir importé 3 dessins.jpg dans les 3 plans de l'espace :
1 : Sur une premier sketch, plan x,y tracé du profil du livet, vu de dessus, avec l'outil B-Spline.
2 : Sur un deuxième sketch, plan y,z tracé du profil du livet, vu de côté, avec l'outil B-Spline.
3 : Création d'une courbe 3D à l'intersection des projections de ces deux B-Spline, avec l'outil "CombinedProjectionCurve" de l'atelier Curves.
4 : Sur un nouveau sketch, création de la ligne de quille, avec l'outil B-Spline. Création de l'étrave avec l'outil ligne. (à ce stade, je commence à ne pas être satisfait de mon travail car la ligne de quille n'est pas propre, elle ressemble plutôt au profil d'un cintre de vêtement redressé à la main... J'ai essayé l'outil "Curveapproximate", qui trace un splendide... ligne droite ! Tant pis, je laisse tomber, on verra bien ce que ça donne avec l'outil "zebra" une fois terminé).
5 : Création de l'arrondi de liaison entre l'étrave et la ligne de quille avec l'outil "BlendCurve" de l'atelier Curves.
6 : Suppression de la ligne d'étrave (qui sera remplacée par une "traverse" sur un sketch dans le plan x,z.
7 : Sélection de la ligne de quille et de l'arrondi et utilisation de l'outil "JoinCurve" pour les lier. (la courbure de la ligne de quille est un peu modifiée ; ce qui est peut-être un bien, peut-être qu'elle est lissée ? mais il n'est plus possible de la modifier pour la remettre dans ses lignes car elle n'a plus de poignée).
8 : J'ai à présent deux rails auxquels je dois appliquer l'outil "RuledSurface". Je l'ai fait, et ça crée bien une surface plane entre les deux rails, mais je suis revenu en arrière pour avoir plus de visibilité pour la suite, considérant que cette opération peut être réalisée plus tard.
9 : Si j'ai bien compris, je dois ajouter des traverses dont les extrémités doivent être "attachées". Et là : grosse galère !!!
?
J'ai tenté l'outil "SupportPlane", les plans sont correctement créés à l'endroit où je compte tracer mes B-Splines mais, lorsque je suis dans l'atelier sketch, il m'est impossible de sélectionner le plan en tant que géométrie extérieure, donc, impossible d'attacher les extrémités des B-Splines des traverses dessus... Comment attacher ces extrémités aux rails ?
Merci de votre aide
Attachments
Bâtô.FCStd
(32.24 KiB) Downloaded 7 times
User avatar
GlouGlou
Posts: 2393
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Curves workbench

Postby GlouGlou » Fri May 29, 2020 4:39 pm

It's working. Just get this edge with the external geometry tool, then hook the Bspline on a vertex. ;)
Attachments
Capture.JPG
Capture.JPG (16.91 KiB) Viewed 193 times
User avatar
GlouGlou
Posts: 2393
Joined: Sun Apr 05, 2015 9:02 am
Location: La Rochelle, France

Re: Curves workbench

Postby GlouGlou » Fri May 29, 2020 5:28 pm

Zolko wrote:
Mon Apr 27, 2020 6:21 pm
I've made a very specific tool that I really needed and couldn't find in the Curves workbench
Your tool is useful. It's would be better if it be parametrized.