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.

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

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")

 

Stop

' Interactively select a linear or ordinate dimension

' Programmatically get the dimension

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) 2010 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.