cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

importStep ignore dimensions

Open HenningScheufler opened this issue 1 year ago • 2 comments

Dimensions inside the step file are not recognized:

import cadquery as cq
import math

r = 1
h = 1
Vol = r**2 * math.pi * h

r_wrong = 1000
h_wrong = 1000
Vol_wrong = r_wrong**2 * math.pi * h_wrong
stp = cq.importers.importStep("cylinder_1000mm.step")
print("volume: ", stp.objects[0].Volume(), " corrected volume: ",r**2 * math.pi * h)
print("volume with wrong dimensions: ", Vol_wrong) 

results in

volume:  3141592653.5897927  corrected volume:  3.141592653589793
volume with wrong dimensions:  3141592653.589793

The step file was created with freecad. The same issue appeared with a 3Dx step file.

HenningScheufler avatar Jul 13 '23 12:07 HenningScheufler

Can you share the step file? NB: CQ has no units.

adam-urbanczyk avatar Jul 14 '23 19:07 adam-urbanczyk

So the defualt import/export unit of OCCT seems to be mm. You can change it for importing using xstep.cascade.unit via e.g. OCP.Interface.Interface_Static.SetCVal_s("write.step.unit","UM")

adam-urbanczyk avatar Jan 23 '24 08:01 adam-urbanczyk