Hide Table of Contents

Get Edge Curve Parameterization Example (VBA)

This example shows how to get the edge curve parameterization for the selected edge using IEdge::GetCurveParams2.

'-----------------------------------------------

'

' Preconditions:

'       (1) Part or assembly is open.

'       (2) If an assembly, it is fully resolved.

'       (3) An edge is selected in the SolidWorks graphics area.

'

' Postconditions: None

'

'-----------------------------------------------

Option Explicit

 

Public Const LINE_TYPE              As Integer = 3001

Public Const CIRCLE_TYPE            As Integer = 3002

Public Const ELLIPSE_TYPE           As Integer = 3003

Public Const INTERSECTION_TYPE      As Integer = 3004

Public Const BCURVE_TYPE            As Integer = 3005

Public Const SPCURVE_TYPE           As Integer = 3006

Public Const CONSTPARAM_TYPE        As Integer = 3008

Public Const TRIMMED_TYPE           As Integer = 3009

 

' Define two types

Type DoubleRec

    dValue As Double

End Type

Type Long2Rec

    iLower As Long

    iUpper As Long

End Type

 

' Extract two integer values out of a single double value,

' by assigning a DoubleRec to the double value and

' copying the value over an Long2Rec and

' extracting the integer values.

Function ExtractFields _

( _

    ByVal dValue As Double, _

    iLower As Long, _

    iUpper As Long _

)

    Dim dr                          As DoubleRec

    Dim i2r                         As Long2Rec

    ' Set the double value

    dr.dValue = dValue

    ' Copy the values

    LSet i2r = dr

    ' Extract the values

    iLower = i2r.iLower

    iUpper = i2r.iUpper

End Function

Sub main()

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.ModelDoc2

    Dim swSelMgr                    As SldWorks.SelectionMgr

    Dim swEdge                      As SldWorks.Edge

    Dim swCurve                     As SldWorks.Curve

    Dim vCurveParam                 As Variant

    Dim nDummy                      As Long

    Dim nIdentity                   As Long

    Dim nTag                        As Long

    Dim nSense                      As Long

    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swEdge = swSelMgr.GetSelectedObject5(1)

    Set swCurve = swEdge.GetCurve

    

    vCurveParam = swEdge.GetCurveParams2

    ExtractFields vCurveParam(8), nDummy, nIdentity

    ExtractFields vCurveParam(9), nDummy, nTag

    ExtractFields vCurveParam(10), nDummy, nSense

    

    Debug.Print "Start      = (" & vCurveParam(0) * 1000# & ", " & vCurveParam(1) * 1000# & ", " & vCurveParam(2) * 1000# & ") mm "

    Debug.Print "End        = (" & vCurveParam(3) * 1000# & ", " & vCurveParam(4) * 1000# & ", " & vCurveParam(5) * 1000# & ") mm "

    Debug.Print "Uparam     = [" & vCurveParam(6) & ", " & vCurveParam(7) & "]"

    Debug.Print "Identity   = " & nIdentity

    Debug.Print "Tag        = " & nTag

    Debug.Print "Sense      = " & nSense

    

    ' Derived quantity

    Debug.Print "Length     = " & swCurve.GetLength2(vCurveParam(6), vCurveParam(7)) * 1000# & " mm "

End Sub

'-------------------------------------------



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Get Edge Curve Parameterization Example (VBA)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2010 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.