Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"1D" sweeps use wrong OCCT function #482

Closed
MatthiasJ1 opened this issue Jan 15, 2024 · 2 comments
Closed

"1D" sweeps use wrong OCCT function #482

MatthiasJ1 opened this issue Jan 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@MatthiasJ1
Copy link
Contributor

The BRepOffsetAPI_MakePipe methods used require a G1 spine which is not being enforced by b3d. There is a different constructor which provides fallback parameters for G0 which should be used instead.
That would make it consistent with the other b3d sweep operations

@gumyr
Copy link
Owner

gumyr commented Jan 16, 2024

I assume you are referring to Face.sweep. I've modified it as:

    @classmethod
    def sweep(cls, profile: Edge, path: Union[Edge, Wire]) -> Face:
        """Sweep a 1D profile along a 1D path"""
        if isinstance(path, Edge):
            path = Wire.make_wire([path])
        # Ensure the edges in the path are ordered correctly
        path = Wire.make_wire(path.order_edges())
        # pipe_sweep = BRepOffsetAPI_MakePipe(path.wrapped, profile.wrapped)
        pipe_sweep = BRepOffsetAPI_MakePipe(
            path.wrapped,
            profile.wrapped,
            # GeomFill_Trihedron.GeomFill_IsConstantNormal,
            # GeomFill_Trihedron.GeomFill_IsCorrectedFrenet,
            # GeomFill_Trihedron.GeomFill_IsDarboux,
            # GeomFill_Trihedron.GeomFill_IsDiscreteTrihedron,
            # GeomFill_Trihedron.GeomFill_IsFixed,
            GeomFill_Trihedron.GeomFill_IsFrenet,
            # GeomFill_Trihedron.GeomFill_IsGuideAC,
            # GeomFill_Trihedron.GeomFill_IsGuideACWithContact,
            # GeomFill_Trihedron.GeomFill_IsGuidePlan,
            # GeomFill_Trihedron.GeomFill_IsGuidePlanWithContact,
            True,
        )
        pipe_sweep.Build()
        return Face(pipe_sweep.Shape())

Here I've tried all of the options for how to sweep a polyline as follows:

line_as_wire = Polyline((0, 0), (10, 10), (20, 10)).wire()
trace_pen = line_as_wire.perpendicular_line(1, 0)
traced = Face.sweep(trace_pen, line_as_wire)

However, all of the results are as follows:
image

@MatthiasJ1
Copy link
Contributor Author

spine = Polyline((0,0), (1,10), (10,10))
sect = spine.wire().perpendicular_line(2, 0)
builder = BRepOffsetAPI_MakePipeShell(spine.to_wire().wrapped)
builder.Add(Wire.make_wire([sect]).wrapped, False, False)
builder.SetTransitionMode(BRepBuilderAPI_RightCorner)
builder.Build()
swept = Shape.cast(builder.Shape())
Screenshot

@gumyr gumyr added the enhancement New feature or request label Jan 26, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Jan 26, 2024
gumyr added a commit that referenced this issue Feb 4, 2024
@gumyr gumyr closed this as completed Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants