[solved] Align ShapeString on a Circle
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!
[solved] Align ShapeString on a Circle
I want to create a circular scale, where each scale tick has a number above it. I sketched the principle in Inkscape:
The part should then be 3d-printed and I want to create pockets for the numbers.
My worflow so far was to create the part in PartDesign and then for each number:
* go to Draft Workbench
* Create a ShapeString with the number
* Move the shapestring into the body
* go to Part Design
* Use "Map sketch to face" and map the ShapeString to the Surface (or XY Plane) using FlatFace attachement
* Adjust the Placement of the ShapeString by rotating it and adjusting the x/y offset - calculated either by hand or in a sketch
* use the pocket function to create the pocket
However, there is a problem with this approach:
The Attachement of the ShapeString is such, that it attaches the lower left corner of the bounding box to 0/0. While in the y-direction, the bbox is exactly at the lower part of the font, there is a spacing in the x-direction.
And thus, it is very hard to really center the number above the line in a defined distance.
See the BBox issue here: I simply attached the ShapeString to the face and opened the Sketcher. Probably the easiest would be, if I could define the origin of the ShapeString somehow. Then, the placement is simple. However, is that possible?
The other possibility would probably be to write a macro that does the placement and takes the additional offset into account.
Attached is a quick example, showing it for a tick mark and text at 60°: btw, there seems to be a bug, that the "Map sketch to face" will not get active, until a sketch is added to the body. Thus, when there is only the ShapeString in the body, you can not use "map sketch to face". A workaround is to always create an (empty) sketch fist or not use that button at all and simply adjust it in the data tab.
Each number should be centered above the tick mark and the lower part of the number should be a defined distance away from the tick mark.The part should then be 3d-printed and I want to create pockets for the numbers.
My worflow so far was to create the part in PartDesign and then for each number:
* go to Draft Workbench
* Create a ShapeString with the number
* Move the shapestring into the body
* go to Part Design
* Use "Map sketch to face" and map the ShapeString to the Surface (or XY Plane) using FlatFace attachement
* Adjust the Placement of the ShapeString by rotating it and adjusting the x/y offset - calculated either by hand or in a sketch
* use the pocket function to create the pocket
However, there is a problem with this approach:
The Attachement of the ShapeString is such, that it attaches the lower left corner of the bounding box to 0/0. While in the y-direction, the bbox is exactly at the lower part of the font, there is a spacing in the x-direction.
And thus, it is very hard to really center the number above the line in a defined distance.
See the BBox issue here: I simply attached the ShapeString to the face and opened the Sketcher. Probably the easiest would be, if I could define the origin of the ShapeString somehow. Then, the placement is simple. However, is that possible?
The other possibility would probably be to write a macro that does the placement and takes the additional offset into account.
Attached is a quick example, showing it for a tick mark and text at 60°: btw, there seems to be a bug, that the "Map sketch to face" will not get active, until a sketch is added to the body. Thus, when there is only the ShapeString in the body, you can not use "map sketch to face". A workaround is to always create an (empty) sketch fist or not use that button at all and simply adjust it in the data tab.
Last edited by reox on Thu Feb 09, 2023 3:50 pm, edited 1 time in total.
- Shalmeneser
- Veteran
- Posts: 9475
- Joined: Wed Dec 23, 2020 12:04 am
- Location: Fr
Re: Algin ShapeString on a Circle
I would draw all the numbers in Inkscape then import this in FreeCAD.
Re: Algin ShapeString on a Circle
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Algin ShapeString on a Circle
Similar discussion on Discord and results having used Lattice2 workbench:
Link to Discord thread (probably need Discord login and join the FreeCAD Project Discord server):
https://discord.com/channels/8708774110 ... 7421432902
Link to Discord thread (probably need Discord login and join the FreeCAD Project Discord server):
https://discord.com/channels/8708774110 ... 7421432902
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Algin ShapeString on a Circle
Thanks! Lattice2 can indeed do that. The trick is to use Orient Mode = Vortex.
Re: Align ShapeString on a Circle
Uhm okay, but there is then still an offset. The arrow base is at the correct position, but not the arrow tip and thus the center of the text itself:
Is there another thing I have to set?- Attachments
-
- lattice_test.FCStd
- (69.46 KiB) Downloaded 38 times
Re: Align ShapeString on a Circle
IWhen using characters there is no a concept of center, but about baseline with numbers you have no problems as they are all over the baseline.
You have to find eventually the width or maybe orient them accordingly and rotate them by 90 degrees as probably it is a dial.
If it is knob it depends on what you want and where is notch position.
There were around some example as clock faces, probably searching the forum for clock and face will give some results.
It is not avstrange thing so probably Lattice2 has already some option.
Try to see his Wiki page.
Regards
Carlo D.
You have to find eventually the width or maybe orient them accordingly and rotate them by 90 degrees as probably it is a dial.
If it is knob it depends on what you want and where is notch position.
There were around some example as clock faces, probably searching the forum for clock and face will give some results.
It is not avstrange thing so probably Lattice2 has already some option.
Try to see his Wiki page.
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: Align ShapeString on a Circle
Thanks! There seems to be also this macro: https://wiki.freecad.org/Macro_FCCircularText
I'll try that as well.
Lattice2 has the issue, that the text is still not aligned at the center, as written above
Re: Align ShapeString on a Circle
Each shape has a boundingbox and you could find the center one of the property of the BoundBox is Center.
Placement property and expressions could maybe help.
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/