Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

opBoolean on Surface Bodies

mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
edited May 2018 in FeatureScript
I'm playing around with a new FS for generating reference points from various inputs. One the potential inputs is 3 surfaces or planes. The first step to getting the point intersection between 3 bodies is to generate a robust curve intersection between 2 bodies. This seems to work well enough for simple cases where 2 bodies create 1 curve. However, opBoolean generates a "BOOLEAN_INVALID" error when intersecting 2 surfaces that should generate 2 curves due to a hole in one of the surfaces. Is there some way to remedy this and get the desired wire bodies? Here's the code I'm using, mostly borrowed from projectedCurve, and a screenshot of the input surfaces being used as tools. Intersecting orange and green works fine, but blue and green gives an error due to blue going through a hole.



try
{
    opBoolean(context, id + "boolean", {
        "tools" : definition.tools,
        "operationType" : BooleanOperationType.INTERSECTION,
        "allowSheets" : true,
        "eraseImprintedEdges" : false,
        "keepTools" : definition.keepTools
    });
}
catch
{
    throw regenError(ErrorStringEnum.REGEN_ERROR);
}

Comments

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,039 ✭✭✭✭✭
    @mahir

    I can't really find a way to get around this either. :disappointed:

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @mahir

    Please file a support ticket on the document with the surfaces in question so that we can investigate where this limitation is coming from.
    Jake Rosenfeld - Modeling Team
  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    @mahir

    Please file a support ticket on the document with the surfaces in question so that we can investigate where this limitation is coming from.
    Dunzo
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,039 ✭✭✭✭✭
    @Jake_Rosenfeld

    It seems to happen whenever it creates more than 1 curve
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,057 PRO
    I can't help but diving in, probably a really big mistake on my part.

    Can't you remove the trimming boundaries from the surfaces and clean the problem up. 

    Does OS give you the polynomials for the intersection of 2 surfaces? 

    And then the solution would be simultaneous equations of 3 curves to resolve 3 unknowns x, y, z?

    Is the solution implicit or explicit?


  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    edited May 2018
    @billy2, I suppose I could process all input surfaces for internal boundaries and fill them, but that's a bit extreme. More importantly, the expected output of intersecting 2 surfaces is the set of curves representing where the surfaces in question actually intersect, not the single curve that would result if both input surfaces had all internal boundaries removed. If that's what I wanted then I would pre-process the surfaces before doing the intersection, but forcing this behavior on what should be generic intersection function isn't the desired behavior.

    And no, I don't believe OS exposes the polynomal coefficients for curve objects. Even if they did, intersecting 3 curves mathematically seems like more work. That would require that I generate 3 curves from the intersection 3 surfaces (2 surfaces at a time). That's 4 steps (3 intersects + 1 set of simultaneous equations). My plan for getting a point from 3 surfaces is to generate a curve(s) from the first 2 surfaces, then intersection the resulting curve with the last surface to get a point. That's only 2 steps. You can actually do what you're suggesting with just 2 curves, but that's still 3 steps - which is more than 2 :)
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,057 PRO
    I agree, let them do the math.

    Does OS provide the base surface definition without boundaries? The only way to remove boundaries is to fill'm in? 

    I haven't played with surface definitions in OS.


  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    edited May 2018
    I don't believe OS exposes mathematical surface or wire body definitions, at least not at the FS level - maybe in the API, which I haven't played with. And FS requires the use of solid/surface/wire bodies for inputs/outputs. I don't believe there is a direct "untrim" function that would just delete an internal boundary. The best you can do is fill the hole and perform a Boolean union with its parent surface.

    On another note, OS has informed me that fixing this shortcoming in opBoolean is probably not happening anytime soon since it could be an issue with Parasolid itself. But I think I can get around the problem by using opSplit instead. It's a roundabout way of getting what I want, but it will hopefully be robust. A query for the resulting edges would look something like qCreatedBy(opSplit, entityType.edge). 
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    billy2 said:
    Does OS provide the base surface definition without boundaries? The only way to remove boundaries is to fill'm in?
    the only type of surface parametrization avaliable in FS is evFaceTangentPlane() function which returns a point and normal of surface for a pair of internal coordinates (u, v), and this function in some cases ignores real face boundaries and returns a point of underlying surface. You can't directly create a surface by feeding equation like (X, Y, Z) = F(u, v) to some surface defining function, as well as curve or solid body
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,057 PRO
    @konstantin_shiriazdanov thanks for the info, a surface normal. I was thinking it might be in a query but I guess the best it gets is face without access to the composition of the face. 


  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,039 ✭✭✭✭✭
    edited May 2018
    @mahir

    Would it work if you did an opBoolean on all three surfaces at once?

    EDIT it doesn't work. I got the intersection another way, though, https://cad.onshape.com/documents/84d939daceef6a928b8abcba/w/9e0dafb21fbe2ec8b983bbdc/e/9a25ae6f38e7d1396b81ed88
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    Yeah, thanks for trying @mbartlett21. I'll be getting around the limitation similarly by using a opSplit instead and extracting the resulting edges.
  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    @billy2, I did find that opSplit has a useTrimmed option that ignores trim boundaries. Still doesn't solve my particular issues, but in theory it takes care of the problem of filling surface holes.


  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,039 ✭✭✭✭✭
    mahir said:
    @billy2, I did find that opSplit has a useTrimmed option that ignores trim boundaries. Still doesn't solve my particular issues, but in theory it takes care of the problem of filling surface holes.


    @mahir
    You can also fill surface holes using opEdgeChange :smile:
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,039 ✭✭✭✭✭
    @mahir

    Onshape's new Intersection Curve feature uses a new operation, opIntersectFaces, which also works if the intersections should result in multiple curves

    Documentation
    geomOperations.fs
    faceIntersection.fs
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    Thanks, @MBartlett21. Mind you I don't even remember what exactly I was working on 4 years ago, but good to know regardless  :D
Sign In or Register to comment.