Hello all,
I made some code for creating parts with cadquery and now i want to export with cq-cli to differents formats such as STEP or GLTF.
# CadQuery 2.x script: 320 mm vented rotor with 5 x M12 holes on 114.3 mm PCDimportos, mathimportcadqueryascqfromcadqueryimportexporters# --------------------# Parameters (mm)# --------------------rotor_od=320.0# outer diameterr_outer=rotor_od/2.0# Friction ring geometryring_inner_radius=120.0# inner radius of friction ring (adjust as needed)plate_thickness=5.0# thickness of each friction plateair_gap=8.0# vent gap between platest_total=plate_thickness*2+air_gap# Hub and mountingpcd=114.3# pitch circle diameter for bolt holesbolt_count=5bolt_hole_d=12.5# M12 typical clearance hole (adjust to fit)center_bore_d=70.0# assumed center bore; confirm with your hubhub_radius=max(pcd/2.0+8.0, center_bore_d/2.0+8.0) # leave margin around holes# Vane and spoke layout (simplified straight vanes)vane_count=24vane_width=8.0# tangential width of each vanespoke_width=8.0# tangential width of spokes connecting hub-to-ring# radial length of vanes across the vented ringvane_radial_len=max(0.0, r_outer-ring_inner_radius)
# radial length of spokes between hub and ring inner radiusspoke_radial_len=max(0.0, ring_inner_radius-hub_radius)
# --------------------# Helper functions# --------------------defpolar_points(radius, count, start_deg=0.0):
return [
(radius*math.cos(math.radians(start_deg+i*360.0/count)),
radius*math.sin(math.radians(start_deg+i*360.0/count)))
foriinrange(count)
]
# --------------------# Build vented rotor# --------------------base=cq.Workplane("XY")
# Top and bottom friction plates (annular rings)top_plate= (
base.circle(r_outer)
.circle(ring_inner_radius)
.extrude(plate_thickness)
)
bottom_plate= (
base.circle(r_outer)
.circle(ring_inner_radius)
.extrude(plate_thickness)
.translate((0, 0, plate_thickness+air_gap))
)
rotor=top_plate.union(bottom_plate)
# Central hub (solid disc) to carry bore and bolt holeshub=base.circle(hub_radius).extrude(t_total)
rotor=rotor.union(hub)
# Vanes: straight rectangular bridges across the air gap# Constructed as boxes centered in Z across the air gapifvane_radial_len>0:
foriinrange(vane_count):
angle=i*360.0/vane_countvane= (cq.Workplane("XY")
.box(vane_radial_len, vane_width, air_gap) # X=radial, Y=tangential, Z=gap
.translate((ring_inner_radius+vane_radial_len/2.0, 0, plate_thickness+air_gap/2.0))
.rotate((0, 0, 0), (0, 0, 1), angle))
rotor=rotor.union(vane)
# Spokes: connect hub to ring inner radius through the air gapifspoke_radial_len>0:
foriinrange(vane_count):
angle=i*360.0/vane_countspoke= (cq.Workplane("XY")
.box(spoke_radial_len, spoke_width, air_gap)
.translate((hub_radius+spoke_radial_len/2.0, 0, plate_thickness+air_gap/2.0))
.rotate((0, 0, 0), (0, 0, 1), angle))
rotor=rotor.union(spoke)
# Center borerotor=rotor.cut(base.circle(center_bore_d/2.0).extrude(t_total))
# Bolt holes on PCD (through all)bolt_radius=pcd/2.0bolt_pts=polar_points(bolt_radius, bolt_count, start_deg=0.0)
bolt_cuts=cq.Workplane("XY").pushPoints(bolt_pts).circle(bolt_hole_d/2.0).extrude(t_total)
rotor=rotor.cut(bolt_cuts)
# Combine into single solid for clean exports / measurementsrotor=rotor.combine()
# Final result for display/export toolsresult=rotorWhen i try to export to step with the simplest command : /cq-cli --codec step --infile "
eb98df729aff4c99812502be7a9f7fcb/generated_22fdb39fedc14ac6afffc2b3f48fe4d2.py"
i have this error :
Conversion codec error: Traceback (most recent call last):
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/main.py", line 550, in main
converted = codec_module.convert(
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/cqcodecs/cq_codec_step.py", line 15, in convert
shape = build_result.results[0].shape
~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
and to GLTF :
Conversion codec error: Traceback (most recent call last):
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/main.py", line 550, in main
converted = codec_module.convert(
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/cqcodecs/cq_codec_gltf.py", line 14, in convert
if type(build_result.first_result.shape).name == "Assembly":
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
I'm not sure my script is fully correct but it works in cq editor :

Do you have any hints or tips or myabe know what can cause this please ?
Thanks in advance
Regards
Hello all,
I made some code for creating parts with cadquery and now i want to export with cq-cli to differents formats such as STEP or GLTF.
When i try to export to step with the simplest command : /cq-cli --codec step --infile "
eb98df729aff4c99812502be7a9f7fcb/generated_22fdb39fedc14ac6afffc2b3f48fe4d2.py"
i have this error :
Conversion codec error: Traceback (most recent call last):
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/main.py", line 550, in main
converted = codec_module.convert(
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/cqcodecs/cq_codec_step.py", line 15, in convert
shape = build_result.results[0].shape
~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
and to GLTF :
Conversion codec error: Traceback (most recent call last):
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/main.py", line 550, in main
converted = codec_module.convert(
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/c/0-sources/Perso/DesignerAgent/venv_cq/lib/python3.12/site-packages/cq_cli/cqcodecs/cq_codec_gltf.py", line 14, in convert
if type(build_result.first_result.shape).name == "Assembly":
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
I'm not sure my script is fully correct but it works in cq editor :
Do you have any hints or tips or myabe know what can cause this please ?
Thanks in advance
Regards