Hide Table of Contents

Insert Linear and Circular Note Patterns (C#)

This example shows how to insert linear and circular note patterns in a drawing.

//---------------------------------------------------------
//
// Preconditions: Specified drawing document to open exists.
//
// Postconditions:
// 1. A note is inserted in the drawing and then selected.
// 2. A linear note pattern (2 instances, including the original
//    note) is inserted in the drawing.
// 3. A circular note pattern (4 instances, including the
//    original note) is inserted in the drawing.
//
// NOTE: Because the model is used elsewhere, do not save
// changes when closing it.
//
//----------------------------------------------------------
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System;

namespace InsertLinearCircularNotePatternsCSharp.csproj
{

    
partial class SolidWorksMacro
    {


        
public void Main()
        {
            ModelDoc2 swModel =
default(ModelDoc2);
            DrawingDoc swDrawingDoc =
default(DrawingDoc);
            Note swNote =
default(Note);
            
bool status = false;
            
int errors = 0;
            
int warnings = 0;


            
// Open drawing document, activate sheet, and make it the active document
            swModel = (ModelDoc2)swApp.OpenDoc6("C:\\Program Files\\SolidWorks Corp\\SolidWorks\\samples\\tutorial\\advdrawings\\foodprocessor.slddrw", 3, 0, "", ref errors, ref warnings);
            swApp.ActivateDoc2(
"foodprocessor - Sheet1", false, ref errors);
            swDrawingDoc = (DrawingDoc)swApp.ActiveDoc;

            
// Insert a note
            swNote = (Note)swModel.InsertNote("Test inserting linear and circular note patterns");

            
// Select the just-inserted note
            status = swModel.Extension.SelectByID2("DetailItem174@Sheet1", "NOTE", 0.2558797881203, 0.3700526, 0, false, 0, null, 0);

            
// Create a linear note pattern using the selected note
            status = swDrawingDoc.InsertLinearNotePattern(2, 1, 0.01, 0.01, 0.7853981633975, 1.570796326795, "");

            
// Create a circular pattern using the selected note
            status = swDrawingDoc.InsertCircularNotePattern(0.075, 4.03202193189, -4, 1.570796326795, true, "");

        }

        
/// <summary>
        /// The SldWorks swApp variable is pre-assigned for you.
        /// </summary>

        public
SldWorks swApp;

    }
}


 



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:   Insert Linear and Circular Note Patterns (C#)
*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) 2012 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.