27 Dec 2023 |
roger_maitland | Download image.png | 15:00:52 |
roger_maitland | My CQ is quite rusty these days, but here is how to position text on the top surface of a box with build123d:
from build123d import *
from ocp_vscode import show
with BuildPart() as example:
Box(100, 100, 5)
with BuildSketch(example.faces().sort_by(Axis.Z)[-1]):
Text("sample", font_size=20)
extrude(amount=2)
show(example)
The with BuildSketch(example.faces().sort_by(Axis.Z)[-1]): means create a sketch on a workplace aligned with the Face of the box that is the most extreme with respect to the Z axis (standard Python list indices/slicing is used). In build123d, Text is always a 2D object so it gets extruded just like any 2D object (it could be swept or lofted, etc.).
build123d has an Algebra mode as well which tends to be more compact which might be attractive if you're generating the code from VBA. | 15:00:53 |
halogenix | Thank you for your responses. It’s weird when I can make the text position with position using workplane origin. But after that it display overlapped on exported cad (dxf) Finally I use workplane translate and can display as I want | 15:22:03 |
| lucky_axolotl_45902 joined the room. | 15:38:37 |
| tomvdb_ joined the room. | 17:11:52 |
| dm4023 joined the room. | 17:25:45 |
28 Dec 2023 |
| skyr__ joined the room. | 10:18:00 |
| easonke joined the room. | 13:17:15 |
| rodolfobonnin_91887 joined the room. | 14:03:14 |
| temp joined the room. | 14:09:48 |
| tidalslug joined the room. | 17:37:12 |
| greenwizard987 joined the room. | 20:09:41 |
| k15a joined the room. | 21:57:33 |
29 Dec 2023 |
| nsfw_c5 changed their display name from Nate In Seattle to nsfw_c5. | 00:10:52 |
| loliver4306 joined the room. | 20:18:20 |
30 Dec 2023 |
| rdm4874 joined the room. | 09:53:29 |
31 Dec 2023 |
| iamhadii joined the room. | 13:10:30 |
| apirkle joined the room. | 16:44:56 |
1 Jan 2024 |
| strayzor joined the room. | 03:25:12 |
| matrix638 joined the room. | 13:07:33 |
2 Jan 2024 |
| mixer3d joined the room. | 11:23:27 |
| mixer3d changed their display name from onlyopen to mixer3d. | 11:24:08 |
| lucandia. changed their display name from lmonari to lucandia.. | 16:26:37 |
| weitzj joined the room. | 19:44:50 |
3 Jan 2024 |
| rawwerks joined the room. | 05:21:11 |
4 Jan 2024 |
| lishine1 joined the room. | 10:23:48 |
| regattaguru_70755 joined the room. | 13:55:05 |
| regattaguru joined the room. | 13:57:37 |
| jackfairhaven joined the room. | 15:11:09 |
5 Jan 2024 |
| meneelyt joined the room. | 12:17:21 |