[Help needed] errors exporting with cq-cli
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Empieza por cq_cli/main.py y las rutas de conversión en cq_cli/cqcodecs/cq_codec_step.py y cq_codec_gltf.py. Ejecuta el script proporcionado mediante cq-cli e inspecciona cómo se rellenan build_result y first_result en comparación con la ejecución mediante cq-editor. La tarea estará terminada cuando el script reportado se gestione de forma coherente y la conversión de STEP y GLTF deje de fallar con estos errores de resultado vacío.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 30
- Forks
- 10
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CadQuery/cq-cli
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Swallows print StatementsAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de CadQuery/cq-cli
Issues similares
-
needs-human needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
gke-labs/kube-agents#2400 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reusedPosiblemente ocupada @sylvesterkaczmarek la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
google-deepmind/bsuite#56 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
LearningCircuit/local-deep-research#7206 ·
Los mantenedores suelen responder en 1 día
-
[TASK] Document technology stackAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
chingu-voyages/V62-tier3-team-33#285 ·
Los mantenedores suelen responder en 1 día