Skip to content

How to get the object's size? #1223

Answered by jmwright
bidzhao asked this question in Q&A
Jan 11, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You can get the size of an object via the BoundingBox in this way.

import cadquery as cq

result = cq.Workplane().box(10, 20, 30)
cq.exporters.export(result, "model.step")

model = cq.importers.importStep("model.step")

for o in model.objects:
    log(o.BoundingBox().xlen)  # prints 10.0
    log(o.BoundingBox().ylen)  # prints 20.0
    log(o.BoundingBox().zlen)  # prints 30.0

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bidzhao
Comment options

@adam-urbanczyk
Comment options

Answer selected by adam-urbanczyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants