Centering ShapeString parametrically
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!
Centering ShapeString parametrically
I am in the process of learning how to manipulate text in freecad and trying to center shapeString on a solid. I have all of my parameters for the solid in a spreadsheet and I notice that the shapestring has some parameters available. I can show the bounding box in the application but I can't figure out how to add it to an equation to center the text when the string changes. Is this possible?
Re: Centering ShapeString parametrically
usually you could retrieve the BoundBox, so probably:nefarious wrote: ↑Fri Feb 03, 2023 6:05 pm I am in the process of learning how to manipulate text in freecad and trying to center shapeString on a solid. I have all of my parameters for the solid in a spreadsheet and I notice that the shapestring has some parameters available. I can show the bounding box in the application but I can't figure out how to add it to an equation to center the text when the string changes. Is this possible?
<<Object>>.Shape.BoundBox. will go.
Take in account that BoundBox are unitless so you have to multiply them * 1mm if not it will not work.
In the file attached in Cube001 placement X you will see an example of expression.
Code: Select all
help(FreeCAD.BoundBox)
Hope it helps
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: Centering ShapeString parametrically
You are welcome to try this macro/Python script.
Select the face and an edge to indicate the direction, then run the script.
Select the face and an edge to indicate the direction, then run the script.
- Attachments
-
- CenterShapeStringOnFace-1.zip
- (5.58 KiB) Downloaded 14 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."