Hide Table of Contents

Automatically Insert Center Marks Example (VB.NET)

This example shows how to automatically insert center marks in multiple drawing views.

'----------------------------------------------------------------------------
' Preconditions: Open:
'    install_dir\samples\tutorial\advdrawings\foodprocessor.slddrw
'
' Postconditions:

' 1. Sheet3 is activated, and center marks are inserted in three of
'    the sheet's views.
' 2. Center marks are inserted in three views of the sheet's views.
' 3. Drawing View7 is suppressed and unsuppressed.

'
' NOTE: Because the model is used elsewhere,
' do not save changes when closing it.
' ---------------------------------------------------------------------------

Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System

Partial Class SolidWorksMacro

    
Dim Part As ModelDoc2
    
Dim Draw As DrawingDoc
   
Dim swModelDocExt as ModelDocExtension
    
Dim swActiveView As View
    
Dim boolstatus As Boolean

    Sub main()

        Part = swApp.ActiveDoc
        Draw = Part
        swModelDocExt = Part.Extension

        Draw.ActivateSheet(
"Sheet3")

        
' Insert center marks for all holes, fillets, and slots in the specified views
        boolstatus = Draw.ActivateView("Drawing View7")
        swActiveView = Draw.ActiveDrawingView
        boolstatus = swActiveView.AutoInsertCenterMarks(7, _
                                                       11, _
                                                      
True, _
                                                      
True, _
                                                      
True, _
                                                       0.0025, _
                                                      
True, _
                                                      
True, _
                                                       0)

   ' Suppress Drawing View7
   boolstatus = swModelDocExt.SelectByID2(
"Drawing View7", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
   Draw.SuppressView()

        boolstatus = Draw.ActivateView("Drawing View9")
        swActiveView = Draw.ActiveDrawingView
        boolstatus = swActiveView.AutoInsertCenterMarks(7, _
                                                       11, _
                                                      
True, _
                                                      
True, _
                                                      
True, _
                                                       0.0025, _
                                                      
True, _
                                                      
True, _
                                                       0)

        boolstatus = Draw.ActivateView(
"Drawing View11")
        swActiveView = Draw.ActiveDrawingView
        boolstatus = swActiveView.AutoInsertCenterMarks(7, _
                                                       11, _
                                                      
True, _
                                                      
True, _
                                                      
False, _
                                                       0.005, _
                                                      
False, _
                                                      
False, _
                                                       0)

        Part.ClearSelection2(
True)

 

        ' Unsuppress Drawing View7
        boolstatus = Part.ActivateView(
"Drawing View7")
        boolstatus = swModelDocExt.SelectByID2(
"Drawing View7", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
        Draw.UnsuppressView()


    
End Sub


    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:   Automatically Insert Center Marks 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) 2013 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.