Among tangible or visible geometric elements, the prominently accessed collections in a Part or Sheetmetal document are the Features, Sketches, Profiles, PMI and the Reference Planes. The most sought after automation requirements include parametric updating of models or creation of simple parts involving sketches that are extruded or revolved.

It is rare for a designer who is also typically a Mechanical guy having specialized as an automation programmer caring to think about diving into low level geometry like the faces, edges and vertices to manipulate model geometry in a more powerful and direct manner.

But once you know how to extract and use it, the possibilities are endless. Some common examples would be custom composite holes or Sheetmetal punch shapes. A scenario of a custom composite hole would be a .150 diameter counterbore with a depth of .200. At the bottom of the counterbore is a thru hole of .050 diameter with a nearside countersink of .070 diameter.

Although this article does not aim to show you all the geometric calculations and APIs involved in achieving such composite holes, it is a beginning in the right direction.

Note the additional Solid Edge Geometry reference that must be added which provides for the meaty part of the API involved in 3D geometry access and manipulation:

Faces and Edges can be accessed for the entire model using the workflow below:

For Each seEdge As Edge In seEdges
If TypeOf seEdge.Geometry Is Line Then seEdge.GetParamExtents(MinParam, MaxParam) seEdge.GetLengthAtParam(MinParam, MaxParam, EdgeLength)
Debug.WriteLine(EdgeLength)
End If
Next

In the function for getting the edge length you also get a quick introduction to the Vertex object. The function also shows there are direct functions to get the start and end vertex of an edge.

All vertices of the body can be accessed simply using with no additional parameters:

My general understanding of the FromParam and To Param is they range between 0 to 1 over the length of the edge, but I could stand corrected in case the implied meaning in Solid Edge is different. This because the API sample for the GetLengthAtParam method uses a range of 0 to PI/2

...

You cannot assume that the parameter range of an edge is between 0 and 1. I would say, it rarely is!!

To get the length of an edge, you should always retrieve the parameter range first and then get the length between both.

Tushar, I have worked with a faces and other low level elements, also we dod a log of work with the Extruded Protrusion and ExtrudedCutOut interfaces. We have recently been attempting add support for the Hole interface. If one looks at the type library, we would expect the techniques we use for accessing the Hole interface would be similar to how we access Extruded Protrusion and ExtrudedCutOut interfaces, but even though our code complies, we geterors on execution. We use Delphi, but could yyou refer me to VB or C# examples that access the Hole interface (we are currently still useing Ordered Geometry)

Currently we model drilled holes in a circuit board using ExtrudedCutouts.

Many of our users would like to be able to use the Solid Edge Hole feature instead of ExtrudedCutouts when the model holes in a circuit board.

We are attempting to update our add-in to support the option to allow the user to model holes with either ExtrudedCutouts or the Hole feature.

Our problem is we cannot access the Solid Edge Hole interface. We have applied the same approach we use for ExtrudedCutouts - we can access both the Hole features and ExtrudedCutouts via Model.Features, but when we try to access the Hole feature by typecasting it to a Hole interface, it fails. ( See the Delphi example code below).

When we encounter issues like this, we can usually resolve them if we have an example VB or C# - could you pint me to an example.

The Solid Edge API has an example but it only returns the name of the Hole feature (which we aslo can do) , but we cannot return any other method of the Hole interface.

here is a procedure I have been using to test this problem (this is Delphi - but we use the same methods os VB or C# )

for i := 1 to Count dobegintryif supports(IDispatch(oModel.Features.Item(i)), ExtrudedProtrusion, oExtrudedProtrusion) thenList.Add(oExtrudedProtrusion) // this gets populated when there is an Extruded Protrusionelse if supports(IDispatch(oModel.Features.Item(i)), ExtrudedCutOut, oExtrudedCutOut) thenList.Add(oExtrudedCutOut) // this gets populated when there is an Extruded Cutoutelse if supports(IDispatch(oModel.Features.Item(i)), Hole, oHole) thenList.Add(oHole) // this never gets populatedexcepton e: exception doShowmessage(e.Message);end;