Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
qAdjacent finding phantom edges in deform feature

Hey there,
I'm working on a feature that will take a body (solid or sheet), a 'From Wire' and a 'To Wire' and deform the body from the From wire to the To wire. In many senses, this is similar to some other features I've seen published (Flex, I'm looking at you), but I haven't been able to get the behavior I'd like with those features.
There is a great deal of code cleanup and optimization that I need to undertake, but I want to get the code functioning as intended first. I'm currently VERY close, but I'm finding some unexpected behavior from my qAdjacent
queries. I'm finding more edges adjacent to some faces than should actually be there. In this case, I'm finding six edges when the surfaces are bounded by five edges.
For each face in the body, I'm creating isoparametric curves on the face, finding intersection points of those curves, and using those points as guides when I recreate the 'deformed' face using opFillSurface
. I'm creating the boundaries of the face by transforming edges. I have my opFillSurface
call wrapped in a try block which lets me add some debug entities when the surface fails. Doing so allows me to count the number of edges and queries that are being passed in. The two surfaces that are failing are both fairly thin surfaces, and both should have five boundaries. However, they're showing six:
I'm using the following query to find all adjacent edges. This was originally just one qAdjacent call, but I've added some additional checks to make sure that all queries resolve to unique entities:
var unfilteredFaceEdges = evaluateQuery(context, qUnion([qAdjacent(thisFace, AdjacencyType.EDGE, EntityType.EDGE)])); var faceEdges = []; for (var e = 0; e < size(unfilteredFaceEdges); e += 1) { var possibleEdge = unfilteredFaceEdges[e]; if (all(faceEdges, function(x) {return !areQueriesEquivalent(context, x, possibleEdge);})) { faceEdges = append(faceEdges, possibleEdge); } }
As the feature is currently setup, when I have the surfOffset variable set to 0mm, the feature works as intended and the surface body deforms all faces. However, when I first offset the surface by 1.3mm and then try to deform it, my code is finding six adjacent edges for these faces, rather than five. I suspect that is why my fill surfaces are failing.
Have I overlooked something simple in trying to find all the adjacent edges of a face? I may be able to work around this quirk for the time being, but I'd like to understand why my code is failing in some scenarios rather than plow forward. Some of the found edges are very small - around 1.8078191630201555e-8 meter long - could this be part of the issue?
Thanks!
-j
Best Answers
-
jelte_steur814 Member Posts: 428 PRO
My suspicion is that your code is working just fine, and it's exposing something in the geometry that you weren't expecting.
when you offset a face, the nr of edges might very well change due to changes in the surfaces.did you try a debug on that micro edge you found to see where it is and whether indeed it shouldn't be part of the chain?
perhaps the Query explorer may also help for troubleshooting.
0 -
Caden_Armstrong Member Posts: 255 PRO
Whats the source of the underlying surface? Is it import geometry or native onshape?
Import geometry can be a bit unpredictable at times.www.smartbenchsoftware.com --- fs.place --- Renaissance
Custom FeatureScript and Onshape Integrated Applications0
Answers
My suspicion is that your code is working just fine, and it's exposing something in the geometry that you weren't expecting.
when you offset a face, the nr of edges might very well change due to changes in the surfaces.
did you try a debug on that micro edge you found to see where it is and whether indeed it shouldn't be part of the chain?
perhaps the Query explorer may also help for troubleshooting.
Whats the source of the underlying surface? Is it import geometry or native onshape?
Import geometry can be a bit unpredictable at times.
Custom FeatureScript and Onshape Integrated Applications
Thanks @Caden_Armstrong and @jelte_steur814 ! The surfaces/bodies are native Onshape surfaces, and offsetting the surfaces DID in fact create a new edge (didn't know it would do that!) I've added some filtering to reject edges if they are shorter than 0.0001mm. I'm not thrilled with that addition - I could see it causing problems down the line - but the surfaces are now deforming as intended. Thanks!
-j
@Jed_Yeiser You could try looking at the untrimmed surface, might solve some of the mysteries.
Jacob posted some details on how to see the untrimmed surface
https://forum.onshape.com/discussion/comment/112233#Comment_112233
Custom FeatureScript and Onshape Integrated Applications