problem with pendingWires and loft

34 views
Skip to first unread message

Laurent Alebarde

unread,
Apr 20, 2023, 12:51:13 PM4/20/23
to CadQuery

I don't master CQ and particularly pendingWires. I want to create sections in a loop and loft them at each step, but CQ returns me an error on line 32 in grey : StdFail_NotDone: BRep_API: command not done.

I have simplified my code to make it readible, it was built from this help:

```
import cadquery as cq
from math import pi as pi, sin as sin, cos as cos, tan as tan, atan as atan

def sabot(teta):
    sabot = cq.Workplane("XY") \
        .ellipseArc(x_radius = 109.6, y_radius = 109.6, angle1 = 0, angle2 = 68.75, sense = -1, startAtCurrent = False) \
        .line(30, 0) \
        .center(0, 0) \
        .ellipseArc(x_radius = 139.6, y_radius = 139.6, angle1 = 0, angle2 = 68.75, sense = 1, startAtCurrent = False) \
        .close() \
        .extrude(150) \
        .faces("<Z").workplane().tag("baseplaneSabot")
    sabot = sabot.workplaneFromTagged("baseplaneSabot").transformed(rotate=(5, 0, 0)).tag("PlanSabotDepouille").split(keepBottom=True)
    sabot = sabot.workplaneFromTagged("baseplaneSabot").transformed(rotate=(30, 0, 0)).tag("PlanSabotAttaque").split(keepTop=True)
    sabot = sabot.workplaneFromTagged("baseplaneSabot").transformed(rotate=(30, 0, 0), offset=(0, 0, 40)).split(keepBottom=True)

    qtPas = 100
    renversoire = None
    wp1 = None
    for i in range(5):
        #i=10
        wp2 = sabot.workplaneFromTagged("baseplaneSabot").transformed(rotate=(0,0,i*68.75/qtPas)).transformed(rotate=(180,0,0), offset=(85, -69, -40)).transformed(rotate=(90,0,0)) \
            .rect(100+i, 30+i)

        if i == 0:
            wp1 = wp2
            continue
        wp1.ctx.pendingWires.extend(wp2.ctx.pendingWires)
        if renversoire == None:
            renversoire = wp1.loft(combine=True)
        else:
            nextpart = None
            nextpart = wp1.loft(combine=True)
            if nextpart:
                renversoire = renversoire.union(nextpart)
        wp1.ctx.pendingWires = []
        wp1 = wp2
#        wp2.ctx.pendingWires = []
    if renversoire:
        sabot = sabot.union(renversoire)
    return sabot

result = cq.Workplane("XY" ).circle(109.6).extrude(30)
result = result.union(sabot(0))
```
Line 22 in blue, I draw a rectangle slightly modified from step to step and the workplane itself turns at each step too. I loft the pending wires of two rectangles in different planes by extending one to the other line 27 in green.

If I limit the loopto 2, I have a first error on line 39 in red : ValueError: Workplane object must have at least one solid on the stack to union!

Lorenz

unread,
Apr 20, 2023, 11:02:51 PM4/20/23
to CadQuery
I'm not sure I follow this example but in issue 327 wp1.ctx and wp2.ctx are different objects.  In this example wp1.ctx and wp2.ctx are the same.
Reply all
Reply to author
Forward
0 new messages