Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Solidworks Perimeter of part

Status
Not open for further replies.

3dcadconsultant

Mechanical
Jun 3, 2009
5
Help.

Trying to get the perimeter and hole count of a 3D model without unfolding it. I have so far


Option Explicit

Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFace As SldWorks.Face
Dim swEdge As SldWorks.Edge
Dim swCurve As SldWorks.Curve
Dim varCurveParams As Variant
Dim varEdgeArray As Variant
Dim Length As Double
Dim bRet As Boolean
Dim i As Long
Dim j As Long



Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager


Set swFace = swSelMgr.GetSelectedObject3(1)

varEdgeArray = swFace.GetEdges

For i = 0 To UBound(varEdgeArray)
Set swEdge = varEdgeArray(i)
Set swCurve = swEdge.GetCurve
Set swCurve = swEdge.GetCurve


varCurveParams = swEdge.GetCurveParams2

Length = Length + swCurve.GetLength(varCurveParams(6), varCurveParams(7))
Next i



MsgBox "Length = " + Str(Length / 0.0254) + " in"
End Sub

My problem is the tangent edges are counted twice. This is one of my first programes and I am just learning any help would be awsome.

Steve
 
Replies continue below

Recommended for you

The "API" referred to here is the American Petroleum Institute, with forum topics being oil tank standards, etc. Not sure what category your question falls under, but there are finite element and AutoCAD forums here somewhere, possible others that would be a closer fit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor