Hide Table of Contents

Get Whether Display Dimension is a Hole Callout Example (VBA)

This example shows how to determine if a display dimension is a hole callout.

'------------------------------------------------------------------
' Preconditions:
' 1. Open install_dir\samples\costing\machined_part.sldprt.
' 2. Click File > Make Drawing from Part > OK, drag-and-drop
'    (A)Top in the drawing, and click OK in the PropertyManager page.
' 3. Click Insert > Annotations > Hole Callout, click any
'    hole in the model, drag-and-drop the hole
'    callout in an empty space in the drawing, and click OK
'    in the PropertyManager page.
' 4. Open the Immediate window.
'
' Postconditions:
' 1. Selects RD1@DrawingView1.
' 2. Gets whether RD1@DrawingView1 is a hole callout and
'    gets its text.
' 3. Examine the Immediate window.
'
' NOTE: Because the part is used elsewhere, do not save changes.
'-------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swDisplayDimension  As SldWorks.DisplayDimension
Dim boolstatus As Boolean
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swModelDocExt = swModel.Extension    
    ' Select hole callout and get its text
    boolstatus = swModelDocExt.SelectByID2("RD1@Drawing View1", "DIMENSION", 0.2385689138462, 0.1081692215385, 0, False, 0, Nothing, 0)
    Set swDisplayDimension = swSelMgr.GetSelectedObject6(1, -1)
    Debug.Print "Is a hole callout? " & swDisplayDimension.IsHoleCallout
    Debug.Print "  Callout portion above text  = " & swDisplayDimension.GetText(swDimensionTextParts_e.swDimensionTextCalloutAbove)
    Debug.Print "  Callout portion below text  = " & swDisplayDimension.GetText(swDimensionTextParts_e.swDimensionTextCalloutBelow)
    Debug.Print "  Prefix of callout = " & swDisplayDimension.GetText(swDimensionTextParts_e.swDimensionTextPrefix)
    Debug.Print "  Suffix of callout = " & swDisplayDimension.GetText(swDimensionTextParts_e.swDimensionTextSuffix)    
    swModel.ClearSelection2 True
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 Whether Display Dimension is a Hole Callout 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) 2016 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.