[Help needed] errors exporting with cq-cli
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia da cq_cli/main.py e dai percorsi di conversione in cq_cli/cqcodecs/cq_codec_step.py e cq_codec_gltf.py. Esegui lo script fornito tramite cq-cli e verifica come vengono valorizzati build_result e first_result rispetto all’esecuzione con cq-editor. Il lavoro è completato quando lo script segnalato viene gestito in modo coerente e la conversione STEP e GLTF non fallisce più con questi errori di risultato vuoto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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 PCD
import os, math
import cadquery as cq
from cadquery import exporters
# --------------------
# Parameters (mm)
# --------------------
rotor_od = 320.0 # outer diameter
r_outer = rotor_od / 2.0
# Friction ring geometry
ring_inner_radius = 120.0 # inner radius of friction ring (adjust as needed)
plate_thickness = 5.0 # thickness of each friction plate
air_gap = 8.0 # vent gap between plates
t_total = plate_thickness * 2 + air_gap
# Hub and mounting
pcd = 114.3 # pitch circle diameter for bolt holes
bolt_count = 5
bolt_hole_d = 12.5 # M12 typical clearance hole (adjust to fit)
center_bore_d = 70.0 # assumed center bore; confirm with your hub
hub_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 = 24
vane_width = 8.0 # tangential width of each vane
spoke_width = 8.0 # tangential width of spokes connecting hub-to-ring
# radial length of vanes across the vented ring
vane_radial_len = max(0.0, r_outer - ring_inner_radius)
# radial length of spokes between hub and ring inner radius
spoke_radial_len = max(0.0, ring_inner_radius - hub_radius)
# --------------------
# Helper functions
# --------------------
def polar_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)))
for i in range(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 holes
hub = 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 gap
if vane_radial_len > 0:
for i in range(vane_count):
angle = i * 360.0 / vane_count
vane = (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 gap
if spoke_radial_len > 0:
for i in range(vane_count):
angle = i * 360.0 / vane_count
spoke = (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 bore
rotor = rotor.cut(base.circle(center_bore_d / 2.0).extrude(t_total))
# Bolt holes on PCD (through all)
bolt_radius = pcd / 2.0
bolt_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 / measurements
rotor = rotor.combine()
# Final result for display/export tools
result = rotor
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
- Lingua principale
- Python
- Stelle
- 30
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CadQuery/cq-cli
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Swallows print StatementsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Tutte le issue di CadQuery/cq-cli
Issue simili
-
enhancement P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Toloka/tolokaforge#1776 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
TencentCloud/Octop#1622 ·
I maintainer di solito rispondono entro 1 giorno
-
Independent PhaseMap objects share and leak their default mode groupingForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Rust: `const _` gets its file's node ID, so the file node is relabelled `_` and gains a self-loopAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Graphify-Labs/graphify#4064 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni