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.

Checking Geometry Quality

darren_13darren_13 Member, Developers Posts: 119 PRO
Hi all, is there a way I can check to ensure there are no small faces or gaps in my geometry? I missed a gap when visually checking which lead me to a lot of troubles in CFD.

Any suggestions welcome, I was thinking about making a feature script and although I can get a readout that there are faces with an area smaller than 'x' I am not sure how best to visually convey the face (debug returns 'Query resolves to 1 faces' however gives no visualisation). 

Cheers,
Darren

Comments

  • darren_13darren_13 Member, Developers Posts: 119 PRO
    I have the Feature script for face size working, but would be still nice to know if there is a better solution.

    Cheers,
    Darren
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Hi @darren_13

    debug() in FeatureScript will make that 1 face highlight in red (but only when your feature dialog is open).  It may be somewhat hard to find this face if it is small.  Some things that could make it more noticeable:

    1. Also highlight the adjacent edges by doing your debug as debug(context, qUnion([smallFaces, qEdgeAdjacent(smallFaces, EntityType.EDGE)]))
    2. Create surfaces from the small faces using opExtractSurface(context, { "faces" : smallFaces })
    Jake Rosenfeld - Modeling Team
  • darren_13darren_13 Member, Developers Posts: 119 PRO
    Thanks, @Jake_Rosenfeld, The edge sounds like a good approach thanks you. 

    For my small gaps script, I compare all edges and if the minimum distance is smaller than a certain tolerance it highlights the edges, this worked ok on a practice geometry but on a realistic one it times out saying possible infinite loop. Do you have any ideas how this could be done otherwise? I want thin channels to be highlighted, possibly even when faces meet at a sharp angle (i.e. where it would be hard to mesh).

    Thanks,
    Darren
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @darren_13

    It may be helpful if you post a link to a public document or paste a code snippet of the comparison code.

    if you're currently doing an evDistance comparison between every pair of edges in the model, you could retool your algorithm to do a comparison between one edge and all the other edges, then the next edge and all the other edges:

    const n = total number of edges
    for i from 0 to n-1
        evDistance between edge i and qSubtraction(qEverything(EntityType.EDGE), qVertexAdjacent(edge i, EntityType.EDGE))
        // Subtracting out the edges that touch because their distance will always be 0
    

    Jake Rosenfeld - Modeling Team
  • darren_13darren_13 Member, Developers Posts: 119 PRO
    Hi @Jake_Rosenfeld, here is the FS link:

    https://cad.onshape.com/documents/a13b77c43656c4cf468905d9/w/2a6908c898e6f9a1fbf619ba/e/7438ad6ffd036af48532a5fa

    I think what you describe above is what is implemented except I used distance = 0 to filter out the highlight, the above would reduce expenses but I'm not sure if it will make a difference. 

    Maybe evaluating minimum between faces might be more efficient.

    Best,
    Darren
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    Hi @darren_13

    This may work or it may not, but it's worth a try on your practical geometry:
    https://cad.onshape.com/documents/afa0c241cd1560ed8fa971c0/w/8794fc3a086f99e464ad2b01/e/9f5b521630d61697dc8dc3cf

    The difference between my algorithm and your algorithm is that mine uses 1 evDistance call to compare edge i to all the other edges, whereas yours uses n evDistance calls to compare i to all of the others (where n is the total number of edges).

    Sorry that it wasn't clear that that was the distinction I was trying to make in my first message.

    Let me know if this also times out.
    Jake Rosenfeld - Modeling Team
  • darren_13darren_13 Member, Developers Posts: 119 PRO
    Oh I see, ok I'll give it a shot cheers!
Sign In or Register to comment.