Hide Table of Contents

Get Transform of Coordinate System Example (VB.NET)

This example shows how to get the transform of a coordinate system.

NOTE: Because VB.NET does not directly support VARIANTs, you must cast the returned objects to the appropriate data types.

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

Private Sub API_Test2()

    Dim swApp As SldWorks.SldWorks

    Dim swModel As SldWorks.ModelDoc2

    Dim swSelMgr As SldWorks.SelectionMgr

    Dim swFeat As SldWorks.feature

    Dim vXformArr() As Double

    Dim vXform As Object

    Dim sAxisName As String

    Dim bRet As Boolean

 

    swApp = CType(CreateObject("SldWorks.Application"), SldWorks.SldWorks)

    swModel = swApp.IActiveDoc2

    swSelMgr = swModel.ISelectionManager

    swFeat = CType(swSelMgr.GetSelectedObject6(1, 0), SldWorks.feature)

    System.Diagnostics.Debug.WriteLine("File = " & swModel.GetPathName)

    System.Diagnostics.Debug.WriteLine("  Current coordinate system = " & swModel.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swFileSaveAsCoordinateSystem))

    System.Diagnostics.Debug.WriteLine("")

    sAxisName = swFeat.Name

    vXformArr = CType(swModel.GetCoordinateSystemXformByName(sAxisName), Double())

    System.Diagnostics.Debug.WriteLine("  " & sAxisName)

    For Each vXform In vXformArr

    Next

    System.Diagnostics.Debug.WriteLine("    Origin = (" + _

                        Str(-1.0# * vXformArr(9) * 1000.0#) + "," + _

                        Str(-1.0# * vXformArr(10) * 1000.0#) + "," + _

                        Str(-1.0# * vXformArr(11) * 1000.0#) + _

                        ") 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 Transform of Coordinate System Example (VB.NET)
*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) 2019 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.