Hide Table of Contents

Create Specific Dimension in a Sketch Example (VB.NET)

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

'----------------------------------------------------------------------------
' Preconditions: Open public_documents\samples\tutorial\api\box.sldprt.
'
' Postconditions: 
' 1. Edits Sketch1.
' 2. Selects two intersecting lines.
' 3. Creates an angular display dimension at the specified location in the
'    sketch.
' 4. Inserts Sketch1.
' 5. Inspect Sketch1 in the graphics area.
'
' NOTE: Because the model is used elsewhere, do not save changes to it.
' ---------------------------------------------------------------------------

 

Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
 
Partial Class SolidWorksMacro
 
    Dim Part As ModelDoc2
    Dim myDisplayDim As DisplayDimension
    Dim boolstatus As Boolean
    Dim err As Integer
 
    Sub main()
 
        Part = swApp.ActiveDoc
        boolstatus = Part.Extension.SelectByID2("Sketch1""SKETCH", 0, 0, 0, False, 0, Nothing, 0)
 
        Part.EditSketch
 
        boolstatus = Part.Extension.SelectByID2("Line3""SKETCHSEGMENT", -0.0509671483361161, -0.0109842011554073, 0.0296211826739789, False, 0, Nothing, 0)
        boolstatus = Part.Extension.SelectByID2("Line2""SKETCHSEGMENT", -0.0770411440149667, 0.00496030150977761, 0.0325476150359756, True, 0, Nothing, 0)
        myDisplayDim = Part.Extension.AddSpecificDimension(-0.0456250220540824, 0, 0.00150965590938767, swDimensionType_e.swAngularDimension, err)
 
        Part.SketchManager.InsertSketch(True)
 
    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:   Create Specific Dimension in a Sketch 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) 2024 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.