Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

2d planar wire extrusion on coincident start & finish #238

Closed
fragmuffin opened this issue Mar 10, 2018 · 5 comments
Closed

2d planar wire extrusion on coincident start & finish #238

fragmuffin opened this issue Mar 10, 2018 · 5 comments

Comments

@fragmuffin
Copy link
Contributor

fragmuffin commented Mar 10, 2018

Problem

2d wires with coincident start & finish points cannot be generated without using .close() to create the last linear wire.

Using .close() imposes a mandatory linear line somewhere on the wire.

Positive Test

The following code functions as I'd expect; extruding a triangle into a 3d solid

import cadquery
from Helpers import show

obj = cadquery.Workplane('XY') \
    .moveTo(0, 0).lineTo(1, 0).lineTo(0, 1) \
    .close() \
    .extrude(1)

show(obj)

simple-solid

Reproducing Erroneous Behaviour

The following are small changes to the above definition of obj

1) Manually closing yields no solid

obj = cadquery.Workplane('XY') \
    .moveTo(0, 0).lineTo(1, 0).lineTo(0, 1) \
    .lineTo(0, 0) \
    .extrude(1)

no solid is generated

edit: no longer considered a bug 👍 ;
wires are not expected to be automatically closed, so a coincident point on a wire does not automatically imply that it is closed.

2) Closing on coincidental point

obj = cadquery.Workplane('XY') \
    .moveTo(0, 0).lineTo(1, 0).lineTo(0, 1) \
    .lineTo(0, 0).close() \
    .extrude(1)

raises exception: Line through identic points

3) Closing on coincidental point (arcs)

thickness = 3.
length = 10.
width = 5.

obj = cadquery.Workplane('XY', origin=(0, 0, -thickness / 2)) \
    .moveTo(length / 2, 0) \
    .threePointArc(
        (0, width / 2), (-length / 2, 0)
    ) \
    .threePointArc(
        (0, -width / 2), (length / 2, 0)
    ) \
    .close().extrude(thickness)

raises exception: BRepAdaptor_Curve::No geometry

Impossible Solid?

There are usually ways to get around this limitation, but I found the following solid impossible to create

biscuit

I ended up creating it in 2 halves, then union both sides.

@dcowden
Copy link
Owner

dcowden commented Mar 10, 2018

Can't find it now, but there has been a lot of discussion on this. It came up when working on dxf import.... It's desirable to get the code the creates the wires from edges separated .

Last I remember, I think I decided that instead of pushing wires onto the pending wires list, we should just collect all of the edges together and form wires in extrude.

@fragmuffin
Copy link
Contributor Author

I imagine any re-design of forming 2d wires will impact #172. Perhaps this could be the first step toward parametric 2d sketches.

@adam-james-v
Copy link
Collaborator

I often end up doing the same thing. It's a workaround in my opinion.

I think that it would be useful to add logic to close(). If the set of edges / wires is open, then add a line to close it, otherwise, just return a single wire and work with that directly.

It might be as simple as checking if start point = end point and doing nothing if that's true...

Or maybe it's way more difficult. That's just a first thought

@fragmuffin
Copy link
Contributor Author

As agreed in #257#issuecomment-385205989, test 1 is not a failed test-case.
So after #257 is merged, I think this issue can be closed

@gntech
Copy link
Contributor

gntech commented Apr 29, 2018

#257 have been merged now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants