Showing results for 
Search instead for 
Do you mean 
Reply

Referencing an edge on a body

Is there a way to get an edge from a body that we know exists, just by having the startPoint and endPoint? And not using the journal identifier. We don't want to have to search through all edges on the bodyand compare start and end points until we the one we are looking for. We would like to be able to get the edge O(1) run time. If you know what that means?

 

Also...

Edge edge1 = (Edge)extractFace1.FindObject("EDGE * 1 * 6 {(4.875,4.25,1.625)(4.875,0.8125,1.625)(4.875,-2.625,1.625) EXTRACT_BODY(1)}");

this is a copy of a journal identifier of the edge we are trying to reference. We understand the coordinates part.

What is the part "EDGE * 1 * 6" referencing?

 

1 REPLY

Re: Referencing an edge on a body

[ Edited ]

If the only info you have is the end-point coordinates, then you'll need to do some geometric calculations to identify the edge. So, as you say, you can cycle through the edges of the body, looking for one that has the known end-points. Note that this won't always work -- the body might have several edges that have the same end-points.

 

You can do it a bit more efficiently using SNAP functions. A SNAP body has a property that gives you all its vertices, and you can cycle through these, instead of cycling through edges, which would probably be a bit faster. Then, once you've got the vertex, you can ask for all the edges that meet at this vertex.

 

Unless the body has millions of edges, cycling through them (or cycling through the vertices) will be very fast, even though it's an O(n) operation. I'd suggest you code this first, and see if it's fast enough. If it's not, then you could implement some sort of hashing or spatial indexing scheme.

山田
yamada