×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API Solidworks Perimeter of part

API Solidworks Perimeter of part

API Solidworks Perimeter of part

(OP)
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

RE: API Solidworks Perimeter of part

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources