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.

Options

How do you create a surface from connected edges--fill() not working?

I am trying to create a surface from an array of edges bounded together forming a region. I am not sure if I am using the fill() function correctly, each time I try to use it I get this error: Precondition failed (surfaceOperationTypePredicate(definition)).

Code: 

Best Answer

Answers

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,713 PRO
    edited December 2022 Answer ✓

    Hi @thomas_lampertius037,

    Depending on the type of edge conditions you want, you will need to place the query in the appropriate location: either G0, G1, or G2.
    Here is one way you can do this:
    opFillSurface(context, id + "opFillSurface1", {
         "edgesG0" : qNothing(),
         "edgesG1" : NestedPockets2Fix,
         "edgesG2" : qNothing(),
         "guideVertices" : qNothing()
    });


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    edited December 2022
    The 3rd input variable for the fill() function is a map, not just a single query of edges. The easiest way to do this is to assign NestedPockets2Fix to the "edges" property of the mapping. This should replicate what the fill feature does, automatically sorting continuity type behind the scenes. You may need to add boolean values for addGuides and showIsocurves.
    fill(context, id + "Fill1", 
         "edges" : NestedPockets2Fix,
    })

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,713 PRO

    @mahir that's legit. I didn't know that. This will save me some if statements.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   cadsharp.com/featurescripts 💎
  • Options
    mahirmahir Member, Developers Posts: 1,291 ✭✭✭✭✭
    @MichaelPascoe Keep in mind the fill() feature has some other overhead that may or may not slow your code down in exchange for the simplified implementation.
Sign In or Register to comment.