Comments (4)
Are you looking for this: assy.constrain(..., "mybox_name?dummybox",...)
? If so, take a look at the assy tutorial: constraints-definition.
from cadquery.
@adam-urbanczyk Thank you for your quick reply, Adam.
I've understood the materials you pointed, and I've tried "mybox?dummybox". The Python interpret gives the following error
KeyError: 'mybox?dummybox'
Actually, my object is to constrain 3D text with the help of BoundBox. My code is as following. At present, I use mybox1 to help me to make the dummy vertex. But it is not possible for further assembly. What I want is to use the tagged "dummybox".
import cadquery as cq
from cadquery.vis import show
text_string = "CadQuery"
font = "Arial"
size = 10
text3D = cq.Workplane("XZ").text(text_string, font=font, fontsize=size, distance=2)
xlen = text3D.val().BoundingBox().xlen
ylen = text3D.val().BoundingBox().ylen
zlen = text3D.val().BoundingBox().zlen
mybox = cq.Workplane().box(xlen, ylen, zlen, centered=True).tag("dummybox").faces("<Y").tag("boxY_Negtive").end().faces("<Z").tag("boxZ_Negtive").end(2)
mybox1 = cq.Workplane().box(xlen, ylen, zlen, centered=True)
asm = cq.Assembly(name="TextOnPanel")
asm.add(text3D, color=cq.Color(1, 0, 0), name="text3D")
asm.add(mybox, color=cq.Color(0, 0, 1), name="mybox")
text3DCenter = text3D.val().BoundingBox().center
myboxCenter = mybox1.val().BoundingBox().center
(
asm
.constrain("text3D@faces@>Y", "mybox?boxY_Negtive", "Axis")
.constrain("text3D@faces@>Z[-1]", "mybox?boxZ_Negtive", "Axis")
.constrain("text3D", cq.Vertex.makeVertex(text3DCenter.x, text3DCenter.y, text3DCenter.z), "mybox?dummybox", cq.Vertex.makeVertex(myboxCenter.x, myboxCenter.y, myboxCenter.z), "Point")
#replacing "mybox?dummybox" with "mybox" could make the code work. However, dummybox is what I want.
)
asm.solve()
show(asm)
from cadquery.
Did you mean:
(
asm
.constrain("text3D@faces@>Y", "mybox?boxY_Negtive", "Axis")
.constrain("text3D@faces@>Z[-1]", "mybox?boxZ_Negtive", "Axis")
.constrain("text3D", "mybox?dummybox", "Point")
)
from cadquery.
Simple, Beautiful! Yes, that's what I want. I'm so obsessed with the CQ's assembly system. Thank you, Adam. @adam-urbanczyk
from cadquery.
Related Issues (20)
- In jupyter lab html export, all cadquery object displays pile up with the last one HOT 1
- CQ-Editor doesn't update when using external editor (gvim or notepad) on windows 11 HOT 4
- Text Alignment Test Failure HOT 14
- About the usage of CQModel? HOT 4
- DXF export for sketch
- Finding coplanar and concentric surfaces HOT 5
- Wrap features (`BRepFeat`) from OCP
- symmetric `thicken`
- Provide Interface to OCCT Messages
- Simple 'cut' of two a Box and a Sphere creates unusable object HOT 3
- Documentation: Assembly tutorial constraint solver result regression HOT 4
- seems parametricCuve()bug HOT 10
- Adding existing geometry into sketches? HOT 1
- Planar surface HOT 1
- Problem of center of mass when a cylinder is generated with a non-default direction HOT 1
- Add selectors for local coordinate system HOT 7
- Assembly top level location ignored
- Selecting a face defined by Sketch on plane HOT 1
- Add docs about referencing subassemlies.
- Working with TDocStd_Document: Empty document when trying to use TDocStd_Application::Open wrapped by OCP HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cadquery.