Hide Table of Contents

Change Tags in Hole Table Example (VB.NET)

This example shows how to change the tags in a hole table.

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

' Preconditions:

'        (1) Drawing document is open that contains

'            a hole table named Hole Table1.

'        (2) Hole Table1 has 4 columns (TAG, X LOC, Y LOC, and SIZE)

'            and at least 5 rows.

'

' Postconditions:

'        (1) Changes to hole table tags are disabled.

'        (2) Tag in column 1, row 2 is changed to Test1.

'        (3) Tag in column 1, row 5 is changed to Test2.

'        (4) Changes to hole table tags are enabled.

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

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst

Imports System

Imports System.Diagnostics

 

Partial Class SolidWorksMacro

 

    Public Sub main()

 

        Dim swModel As ModelDoc2

        Dim swSelMgr As SelectionMgr

        Dim swHoleTable As HoleTable

        Dim boolstatus As Boolean

 

        swModel = swApp.ActiveDoc

        swSelMgr = swModel.SelectionManager

        boolstatus = swModel.Extension.SelectByID2("Hole Table1", "HOLETABLE", 0, 0, 0, False, 0, Nothing, 0)

        swHoleTable = swSelMgr.GetSelectedObject6(1, -1)

        swHoleTable.EnableUpdate = False 'Disable updating hole table tags

        Debug.Print("Original name of tag in column1, row 2:   " & swHoleTable.HoleTag(1))

        swHoleTable.HoleTag(1) = "Test1"

        Debug.Print("New name of tag in column1, row 2:        " & swHoleTable.HoleTag(1))

        Debug.Print("")

        Debug.Print("Original name of tag in column1, row 5:   " & swHoleTable.HoleTag(4))

        swHoleTable.HoleTag(4) = "Test1"  ' Fails because same name is used in row 2

        swHoleTable.HoleTag(4) = "Test2"

        Debug.Print("New name of tag in column1, row 2:        " & swHoleTable.HoleTag(4))

        swHoleTable.EnableUpdate = True 'Enable updating hole table tags

    End Sub

 

    ''' <summary>

    ''' The SldWorks swApp variable is pre-assigned for you.

    ''' </summary>

    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

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Change Tags in Hole Table 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) 2014 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.