Hide Table of Contents

Get Edge Curve Parameterization Example (VB.NET)

This example shows how to get curve parameterization data for a selected edge.

' 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.
' 4. Open an Immediate Window.
' Postconditions:
' Inspect the Immediate Window.
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System
Imports System.Diagnostics

Partial Class SolidWorksMacro

Sub main()
Dim swApp As SldWorks
Dim Part As ModelDoc2

        swApp = CreateObject(
        Part = swApp.ActiveDoc

Dim swSelectMgr As SelectionMgr
        swSelectMgr = Part.SelectionManager

Dim swEdge As Edge
        swEdge = swSelectMgr.GetSelectedObject5(1)

Dim swCurve As Curve
Dim swCurveParaData As CurveParamData
        swCurve = swEdge.GetCurve
        swCurveParaData = swEdge.GetCurveParams3

"The curve tag is: " & swCurveParaData.CurveTag)
"The curve type as defined in swCurveType_e is: " & swCurveParaData.CurveType)

Dim vEndPoint As Object
        vEndPoint = swCurveParaData.EndPoint
Dim EndPoint(2) As Double

        Dim i As Long

        For i = 0 To UBound(vEndPoint)
            EndPoint(i) = vEndPoint(i)
Next i

"The end point x,y,z coordinates are: " & EndPoint(0) & "," & EndPoint(1) & "," & EndPoint(2))

Dim vStartPoint As Object
        Dim StartPoint(2) As Double
        vStartPoint = swCurveParaData.StartPoint
For i = 0 To UBound(vStartPoint)
            StartPoint(i) = vStartPoint(i)
Next i

"The start point x,y,z coordinates are: " & StartPoint(0) & "," & StartPoint(1) & "," & StartPoint(2))

"The curve and edge are in the same direction: " & swCurveParaData.Sense)
"The maximum U parameter value is: " & swCurveParaData.UMaxValue)
"The minimum U parameter value is: " & swCurveParaData.UMinValue)

End Sub

    Public swApp As SldWorks

End Class

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

Subject:   Feedback on Help Topics
Page:   Get Edge Curve Parameterization Example (VB.NET)
*   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:


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

Web Help Content Version: API Help (English only) 2012 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.