Thanks. I've fixed it for the next update. How might we also provide a rotation angle (about the z axis)?edwilliams16 wrote: ↑Thu Mar 10, 2022 3:15 am Minor nitpick - if c is the eccentricity of the ellipse, you have the wrong formula for its minor radius.
Parametric Curve FP discussion board
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
-
- Veteran
- Posts: 3179
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
Easy enough to rotate - but I think would be better done by playing with the attachment, which is likely going to be used anyway. Could also change the input angle to dgrees?
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
... testing the abilities of ParaCurve at known examples, like great circle for a winding pattern,
I have problems to make up a second curve (here a helix), getting it not to execute => some file or fxx problem???
I tried to reproduce a winding pattern for CFR-composite for a high pressure vessel =>
https://www.ke-next.de/files/upload/pos ... ooster.jpg
Edit: Helix solved with an earlier version of ParaCurve.
I have problems to make up a second curve (here a helix), getting it not to execute => some file or fxx problem???
I tried to reproduce a winding pattern for CFR-composite for a high pressure vessel =>
https://www.ke-next.de/files/upload/pos ... ooster.jpg
Edit: Helix solved with an earlier version of ParaCurve.
- Attachments
-
- ParCurve_GreatCircle_3.FCStd
- FC.19.4
- (246.62 KiB) Downloaded 60 times
-
- ParCurve_GreatCircle_2.FCStd
- FC.19.4
- (74.55 KiB) Downloaded 65 times
Last edited by hammax on Fri Mar 11, 2022 7:47 am, edited 2 times in total.
-
- Veteran
- Posts: 3179
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
I'm having problems with the 03.22.10 version. If I start a new file, run the macro, double-click to edit, then click apply, I get the following error:
If I change formula or edit one, I get the same error. I can open files with existing curves.
OS: macOS High Sierra (10.13)
Word size of FreeCAD: 64-bit
Version: 0.20.27809 (Git)
Build type: Release
Python 3.9.10, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
Installed mods:
* Curves 0.3.0
* DynamicData 2.32.0
* fcgear
* lattice2
* MeshRemodel 1.8918.0
* toSketch
Code: Select all
08:50:56 Traceback (most recent call last):
File "/Users/ed/Library/Preferences/FreeCAD/Macro/Parametric_Curve_FP.py", line 1381, in clicked
if hasattr(fp,"Sorted"):
<class 'NameError'>: name 'fp' is not defined
OS: macOS High Sierra (10.13)
Word size of FreeCAD: 64-bit
Version: 0.20.27809 (Git)
Build type: Release
Python 3.9.10, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
Installed mods:
* Curves 0.3.0
* DynamicData 2.32.0
* fcgear
* lattice2
* MeshRemodel 1.8918.0
* toSketch
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
Easy to fix. Instead of fp it should have been self.fp in lines 1382 and 1383. I have added it to the next update, but you can apply the changes yourself in the meantime if you like. You will need to delete Parametric_FP.py so it gets rebuilt after applying the changes, and then restart.edwilliams16 wrote: ↑Thu Mar 10, 2022 6:59 pm I'm having problems with the 03.22.10 version. If I start a new file, run the macro, double-click to edit, then click apply, I get the following error:
If I change formula or edit one, I get the same error. I can open files with existing curves.Code: Select all
08:50:56 Traceback (most recent call last): File "/Users/ed/Library/Preferences/FreeCAD/Macro/Parametric_Curve_FP.py", line 1381, in clicked if hasattr(fp,"Sorted"): <class 'NameError'>: name 'fp' is not defined
OS: macOS High Sierra (10.13)
Word size of FreeCAD: 64-bit
Version: 0.20.27809 (Git)
Build type: Release
Python 3.9.10, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: C/Default (C)
Installed mods:
* Curves 0.3.0
* DynamicData 2.32.0
* fcgear
* lattice2
* MeshRemodel 1.8918.0
* toSketch
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
Thanks for testing. I think I have found the problem. Be sure to open the report view and watch for error messages if things are not working. These can aid in troubleshooting. I have added some additional warning messages. These I might convert to log messages in the future if they prove to be too annoying.hammax wrote: ↑Thu Mar 10, 2022 11:37 am ... testing the abilities of ParaCurve at known examples, like great circle for a winding pattern,
I have problems to make up a second curve (here a helix), getting it not to execute => some file or fxx problem???
I tried to reproduce a winding pattern for CFR-composite for a high pressure vessel => https://www.bing.com/images/search?
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board (latest: 0.2022.03.09)
Latest version 2022.03.10.rev2
Bug fixes
Check for compatibility with editor in case object was created with older version
Add some warning messages when unable to create shape, might be later changed to log messages if these prove to be too annoying.
Rename editor window title from Edit formulas to Formula editor, with version information.
Bug fixes
Check for compatibility with editor in case object was created with older version
Add some warning messages when unable to create shape, might be later changed to log messages if these prove to be too annoying.
Rename editor window title from Edit formulas to Formula editor, with version information.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board
Latest version 0.2022.03.10.rev3
Adds new function fc(expr)
Usage:
fc(expr) is evaluated using FreeCAD's expression engine.
Pseudo code for its implementation:
fc(expr): FreeCAD.DocumentObject.evalExpression(expr)
Some examples:
a = fc(Cylinder.Height)
Presuming there is an object in the document named Cylinder, this would set a to the Cylinder's Height property. Caveat: this is not parametric. That is, when Cylinder's Height property changes, the ParametricCurve object is not automatically recomputed, like you might expect it to be. You would need to manually recompute the ParametricCurve object to use the new Cylinder.Height property value.
To mitigate this I have added a new property called "Dependencies" in the Curve section. You can add the Cylinder to the Dependencies property (App::PropertyLinkList) to create this dependency manually. Then from now on when Cylinder recomputes, the ParametricCurve object will also recompute. In a way this little quirk can be good because it can help to avoid cyclic redundancies in some situations.
It should be possible to use any valid expression with fc(expr). Let me know if there is an expression that fails, but works when entering into the python console:
Note: You can use this for any of the string variables in a formula: a, b, c, d1, d2, dN, X, Y, and Z and it will recompute when you manually recompute, but for the float properties: t_min, interval, and t_max you should use the expression engine directly instead since these are floating point properties, with good support for this. You can use fc(expr) in the JSON formulas for these float properties, too, but they will be converted to float constants and will not be re-evaluated on recompute.
From a performance standpoint it appears fc(expr) works just as fast as using the normal evaulate() function, at least it does in my initial test. It could be recompute times will be slower in some cases, or possibly faster, but in my rudimentary testing they were roughly the same. In my test I compared recompute times when using a = 20 and a = fc(20). Of course, adding dependencies might cause some unnecessary recomputes of the ParametricCurve object, slowing down recompute times for the document as a whole.
Adds new function fc(expr)
Usage:
fc(expr) is evaluated using FreeCAD's expression engine.
Pseudo code for its implementation:
fc(expr): FreeCAD.DocumentObject.evalExpression(expr)
Some examples:
a = fc(Cylinder.Height)
Presuming there is an object in the document named Cylinder, this would set a to the Cylinder's Height property. Caveat: this is not parametric. That is, when Cylinder's Height property changes, the ParametricCurve object is not automatically recomputed, like you might expect it to be. You would need to manually recompute the ParametricCurve object to use the new Cylinder.Height property value.
To mitigate this I have added a new property called "Dependencies" in the Curve section. You can add the Cylinder to the Dependencies property (App::PropertyLinkList) to create this dependency manually. Then from now on when Cylinder recomputes, the ParametricCurve object will also recompute. In a way this little quirk can be good because it can help to avoid cyclic redundancies in some situations.
It should be possible to use any valid expression with fc(expr). Let me know if there is an expression that fails, but works when entering into the python console:
Code: Select all
FreeCAD.DocumentObject.evalExpression(expr)
From a performance standpoint it appears fc(expr) works just as fast as using the normal evaulate() function, at least it does in my initial test. It could be recompute times will be slower in some cases, or possibly faster, but in my rudimentary testing they were roughly the same. In my test I compared recompute times when using a = 20 and a = fc(20). Of course, adding dependencies might cause some unnecessary recomputes of the ParametricCurve object, slowing down recompute times for the document as a whole.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Parametric Curve FP discussion board
New version: 0.2022.03.10.rev4
bug fix (reset button in dialog)
bug fix (reset button in dialog)
-
- Veteran
- Posts: 3179
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Parametric Curve FP discussion board
I must be missing something because I can't make this work at all. If I have a file with nothing but a Part.Cylinder, in the Python Console I get
Code: Select all
>>> App.DocumentObject.evalExpression(Cylinder.Height)
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'Cylinder' is not defined
>>> App.DocumentObject.evalExpression(<<Cylinder>>.Height)
File "<input>", line 1
App.DocumentObject.evalExpression(<<Cylinder>>.Height)
^
SyntaxError: invalid syntax
>>>