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.
Featurescript: Can't get qEdgeAdjacent to work?
jrs_spedley
Member Posts: 71 ✭✭
This basically my code with some bloat stripped out. It creates an edge between two points and extrudes it into a face, then into a body (a door in this case). I then want to extrude the face along the hinge so that I can form a union with the door frame (i.e. not just joined at an edge).
I'm getting there but not sure on qEdgeAdjacent and qVertexAdjacent (they keep giving me no results).
//create edge between two point
I'm getting there but not sure on qEdgeAdjacent and qVertexAdjacent (they keep giving me no results).
//create edge between two point
opFitSpline(context, id + "doorBase", {
"points" : [ origin, otherside ]
});
// opExtrude edge ...
...
// opExtrude face ...
// turn doorBase into query
var doorBase is Query = qCreatedBy(id + "doorBase", EntityType.EDGE);
// find all faces that use doorBase
var facesFromEdge=qEdgeAdjacent(doorBase, EntityType.FACE);
// get doorOrigin from Vertex Query
var doorOrigin=qNthElement(definition.doorCorners, 0);
// find all faces that use door Origin
var facesFromVertex=qVertexAdjacent(doorOrigin, EntityType.FACE);
// to do ...
// find face which is in qOwnedByBody of the door and facesFromVertex but not in facesFromEdge
// this face is the hinge edge of the door required for extrusion.
Tagged:
0
Comments
Can I just clarify this function, it is easy to get confused as to how it works ...
Does the following qEdgeAdjacent search the entire Part Studio for any FACES which were created using doorBase as an EDGE?
If there is another edge in exactly the same position as doorBase, could that make a difference to the results?
If I created another FACE using the doorBase edge and translated it (i.e. away from the original doorBase) would it still be returned in the results?
facesFromEdge = qEdgeAdjacent( doorBase, EntityType.FACE );
EntityType
that share an edge with any entities that match the input query.so qEdgeAdjacent( doorBase, EntityType.FACE ) will return faces adjacent to the doorBase query, if you need edges adjucent to the doorBase face you need - qEdgeAdjacent( doorBase, EntityType.EDGE )
qEdgeAdjacent( A, B);
Internally it will generate a list of all the edges in the entire Part Studio used by any entity in the list A. This could be all the edges connected to single VERTEX in list A or all the EDGES of a BODY in list A, or both etc.
It then returns a list of all the entities of TYPE B from the entire Parts Studio which use any of the edges it generated in the internal list.
Is that right?
For example:
The name is meant to contrast edge-adjacency with vertex-adjacency.
Yes, that is what I thought.
This produces what you'd expect because you passed it an edge in defintion.edge1
But this uses the verticies of the edge from definition.edge2
That is exactly what I thought, although I kept getting it backwards! Thanks.
I assumed that a face extruded from an edge shared that edge but it doesn't, it makes 4 new ones.
To get the entities geometrically on a certain point, you can use qContainsPoint()
Here is the finished code (the relevant part anyway)
"newDoor" is a body - a door in this case - created from two Points: origin and otherside
The purpose of the function is to find the face of the door next to the hinge (origin) and is returned in faceByHinge