Quick Placement editor
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 8
- Joined: Fri Nov 19, 2021 9:05 pm
Quick Placement editor
Is there any way to really fast access to Placement edit fields?
In most cases, they contain formulas, so, to start editing them, I should make several click series:
1) Open closed by default Placement branch item
2) Open closed by default Position item
3) Try to get click into the minuscule formula editor circle to open field that I need
Oh, come on...
The ideal solution (as for me now) is just
a) select an element
b) press hot-key or toolbar button
c) get the form with three (or more additional) fields with x, y, and z that already contains formulas that can be edited all at once on one form.
Is it possible to implement? Please guide me how to make it or gime a link to a similar solution.
In most cases, they contain formulas, so, to start editing them, I should make several click series:
1) Open closed by default Placement branch item
2) Open closed by default Position item
3) Try to get click into the minuscule formula editor circle to open field that I need
Oh, come on...
The ideal solution (as for me now) is just
a) select an element
b) press hot-key or toolbar button
c) get the form with three (or more additional) fields with x, y, and z that already contains formulas that can be edited all at once on one form.
Is it possible to implement? Please guide me how to make it or gime a link to a similar solution.
Re: Quick Placement editor
Are you aware of Std_Placement? And there is also Std_TransformManip (not for formulas)
-
- Posts: 8
- Joined: Fri Nov 19, 2021 9:05 pm
Re: Quick Placement editor
Yes, I am. However, I need the same or similar form(s) especially for the formulas editing
Re: Quick Placement editor
When you enter a formula, you are on your own, these dialogs are made to be used with UI.comunityfc wrote: ↑Wed May 31, 2023 9:34 am Yes, I am. However, I need the same or similar form(s) especially for the formulas editing
You could use as example this construct:
See maybe:placement(base; rotation; center)
https://wiki.freecad.org/Expressions
under:
Object creation functions
I doubt that is possible to open a new dialog when you have already open the "expression editor" (From What I Know it is called this way on FreeCAD).
Or a more complex dialog have to be made with helpers functions to enter things in the "expression editor".
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/
-
- Posts: 8
- Joined: Fri Nov 19, 2021 9:05 pm
Re: Quick Placement editor
The question is not about "how to write expressions correctly", but "hot to pull expression text from the object's properties, and then push it back edited" (using built-in Python macros), so that FreeCAD redraw your model after your editing...
Re: Quick Placement editor
If you use expressions they are recalculated if data will change.comunityfc wrote: ↑Fri Jun 02, 2023 4:13 pm The question is not about "how to write expressions correctly", but "hot to pull expression text from the object's properties, and then push it back edited" (using built-in Python macros), so that FreeCAD redraw your model after your editing...
So the retrieve of properties from objects are in expression wiki page, you should assign it with python if you want.
Try to put data in a spreadsheet and it will work, I use it to change orientations of assemblies and to tune model parameters.
A simple doc.recompute() will update things.
Regards
Carlo D.
Last edited by onekk on Tue Jun 20, 2023 7:55 am, edited 1 time in total.
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/
-
- Posts: 8
- Joined: Fri Nov 19, 2021 9:05 pm
Re: Quick Placement editor
Thanks a lot Carlo for trying to help me. However, you're giving me answers to the questions I wasn't asked.
Let me repeat my main issue. I don't know how to implement the expression EDITING process.
i.e. I need a Python code for the function that will do the following:
1 - Create a GUI form with one text edit field and two buttons - Update and Cancel
2 - Take from the first given parameter object label (not name but label that I can see in the model tree)
3 - Take from the second parameter the parameter name that I want to edit
4 - Pull its expression or value if there is no expression in it
5 - Fill text edit box with pulled value and show form to edit pulled text
6 - On pressing the Update button - get (edited) text from the text edit field and push it back to the parameter
7 - Recompute the entire model or may be edited object only.
From all list above, I can do the only first item (
I would appreciate it if the CF community could assist me with the rest.
BTW about 3-d item: I was very surprised to see In the properties' tree Base / Placement / z although in the Python code I should write Placement.Base.z
Let me repeat my main issue. I don't know how to implement the expression EDITING process.
i.e. I need a Python code for the function that will do the following:
1 - Create a GUI form with one text edit field and two buttons - Update and Cancel
2 - Take from the first given parameter object label (not name but label that I can see in the model tree)
3 - Take from the second parameter the parameter name that I want to edit
4 - Pull its expression or value if there is no expression in it
5 - Fill text edit box with pulled value and show form to edit pulled text
6 - On pressing the Update button - get (edited) text from the text edit field and push it back to the parameter
7 - Recompute the entire model or may be edited object only.
From all list above, I can do the only first item (
I would appreciate it if the CF community could assist me with the rest.
BTW about 3-d item: I was very surprised to see In the properties' tree Base / Placement / z although in the Python code I should write Placement.Base.z
Re: Quick Placement editor
Hi
1, 3, 5, 6 : Qt_Example
2: Manual_search_of_an_element_with_label
4:
No cyclic reference detection on subparameters
evalExpression as a class/static method
evalExpression
setExpression
7:
8: my signature for more
mario
1, 3, 5, 6 : Qt_Example
2: Manual_search_of_an_element_with_label
4:
No cyclic reference detection on subparameters
evalExpression as a class/static method
evalExpression
setExpression
7:
Code: Select all
App.ActiveDocument.recompute()
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Quick Placement editor
Not more to add to @mario52 answer, it is not too hard and documented somewhere in the wiki. Read the Wiki and you will find many things.comunityfc wrote: ↑Fri Jun 02, 2023 8:26 pm ...
BTW about 3-d item: I was very surprised to see In the properties' tree Base / Placement / z although in the Python code I should write Placement.Base.z
Speaking about code, it is hard to guess what you are trying to do, a good expectation is that you post some code and ask for advice on code you have written, if not writing code from scratch is very near to a "paid job" than to an user to user volunteer help.
There are some idiosyncrasies but if you activate things like in the introductory Python scripting document in the Wiki, you will have some echo in Python Consolee that will help you to guess "how things are working", some of these idiosyncrasies have to be taken as is as it is not advisable to change this strange behaviour as it will break almost any Python FreeCAD code around, just take as is Placement.Base is the "Translation Vector" component in a FreeCAD.Placement object.
The other component is a FreeCAD.Rotation. object.
Once learned it is not too difficult to manage.
Regards
Carlo D.
Last edited by onekk on Tue Jun 20, 2023 7:56 am, edited 2 times in total.
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: Quick Placement editor
Is there a Qt widget that is expressions aware?