Hide Table of Contents

Create Angular Dimension Example (VBA)

This example shows how to add an angular display dimension to a sketch.

'----------------------------------------------------------------------------
' Preconditions:
' 1. Open public_documents\samples\tutorial\api\box.sldprt.
' 2. Press F8 repeatedly to step through the macro.
'
' Postconditions: 
' 1. Edits Sketch1.
' 2. Creates an angular dimension.
' 3. Displays the dimension for:
'    * Angle defined by the selected sketch segment and an extension line
'      that is drawn to the right of the selected sketch point
'      (Direction = swSmartDimensionDirection_Right)
'    * Explementary angle
'    * Vertically opposite angle
'
' NOTE: Because the model is used elsewhere, do not save changes to it.
' ---------------------------------------------------------------------------

Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim myDisplayDim As SldWorks.DisplayDimension
Dim boolstatus As Boolean

Option Explicit
Sub main()

    Set swApp = Application.SldWorks
   

    Set Part = swApp.ActiveDoc
    boolstatus = Part.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
    Part.EditSketch

    boolstatus = Part.Extension.SelectByID2("Line2", "SKETCHSEGMENT", -6.72289031567236E-02, 1.80603779387131E-02, 1.84698306816742E-02, False, 0, Nothing, 0)
    boolstatus = Part.Extension.SelectByID2("Point1", "SKETCHPOINT", -8.11067833265636E-02, 3.89478433654258E-02, 0, True, 0, Nothing, 0)

    Set myDisplayDim = Part.Extension.AddDimension(-4.56250220540824E-02, 0, 1.50965590938767E-03, swSmartDimensionDirection_Right)
    myDisplayDim.ExplementaryAngle
    myDisplayDim.VerticallyOppositeAngle

   
Part.SketchManager.InsertSketch 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:   Create Angular Dimension 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) 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.