Hide Table of Contents

Add and Offset Dimension Extension Lines Jogs (VBA)

This example shows how to jog the selected dimension's extension lines and to then offset the jogs.

'-------------------------------------------------------------------------------
' Preconditions: Open public_documents\samples\tutorial\advdrawings\foodprocessor.slddrw.
'
' Postconditions:
' 1. Selects a linear dimension.
' 2. Jogs the selected dimension's extension lines.
' 3. Offsets the jogs.
' 4. Select the highlighted dimension in the drawing.
' 5. Click anywhere outside the drawing view in the drawing
'    and examine the extension lines of the dimension.
'
' NOTE: Because the drawing is used elsewhere, do not save changes.
'-------------------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDisplayDim As SldWorks.DisplayDimension
Dim swModelView As SldWorks.ModelView
Dim boolstatus As Boolean
Dim index As Integer
Dim jogged As Boolean
Dim offset1 As Double, offset2 As Double, offset1to2 As Double
Dim rect As Variant
Sub main()
    
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swModelView = swModel.ActiveView
    Set swSelMgr = swModel.SelectionManager
    Set swModelDocExt = swModel.Extension        
    boolstatus = swModel.ActivateView("Drawing View1")
    boolstatus = swModelDocExt.SelectByID2("RD9@Drawing View1", "DIMENSION", 0.214177376160146, 0.307386295566502, 0, False, 0, Nothing, 0)
    Set swDisplayDim = swSelMgr.GetSelectedObject6(1, -1)    
    ' Add jogs to the dimension's extension lines
    boolstatus = swModelDocExt.JogDimension(True, 0)
    boolstatus = swModelDocExt.JogDimension(True, 1)    
    ' Offset the jogs
    index = 0
    boolstatus = swDisplayDim.GetJogParameters(index, jogged, offset1, offset2, offset1to2)
    offset1 = offset1 + offset1 * 0.1
    offset2 = offset2 + offset2 * 0.2
    offset1to2 = offset1to2 + offset1 * 0.2
    boolstatus = swDisplayDim.SetJogParameters(index, jogged, offset1, offset2, offset1to2)
    
    index = 1
    boolstatus = swDisplayDim.GetJogParameters(index, jogged, offset1, offset2, offset1to2)
    offset1 = offset1 + offset1 * 0.1
    offset2 = offset2 + offset2 * 0.2
    offset1to2 = offset1to2 + offset1 * 0.2
    boolstatus = swDisplayDim.SetJogParameters(index, jogged, offset1, offset2, offset1to2)
   
    swModelView.GraphicsRedraw ((rect))
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:   Add and Offset Dimension Extension Lines Jogs (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) 2018 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.