Skip to content

understanding the "translate()" functionality #1185

Answered by lorenzncode
jbernalr asked this question in Q&A
Discussion options

You must be logged in to vote

The origin depends on centerOption when creating a workplane on a face. One way to change the origin is to specify it (requires "ProjectedOrigin" centerOption which is the default).

result = (
    cq.Workplane()
    .box(10, 10, 30)
    .faces(">Z")
    .workplane(origin=(0, 2, 0))
    .rect(6, 6)
    .extrude(-10, combine="s")
)

Or call center:

result = (
    cq.Workplane()
    .box(10, 10, 30)
    .faces(">Z")
    .workplane()
    .center(0, 2)
    .rect(6, 6)
    .extrude(-10, combine="s")
)

Another way to locate a workplane is covered in the docs example "Locating a Workplane on a vertex". Here locating on an edge:

result = (
    cq.Workplane()
    .box(10, 10, 30)
    .faces(">Z")
    .

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jbernalr
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jbernalr
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants