Collapse Getting StartedGetting Started
Expand Types of SolidWorks API ApplicationsTypes of SolidWorks API Applications
Expand SolidWorks API Object Model and Class HierarchySolidWorks API Object Model and Class Hierarchy
Collapse Programming with the SolidWorks APIProgramming with the SolidWorks API
Expand Add-insAdd-ins
API Dependent on SolidWorks Being Visible
Attributes Imported from ACIS SAT Files
Block Definitions and Block Instances
Bodies in Body Folders
Bounding Box and Note Text
COM vs. Dispatch
CommandManager and CommandGroups
Components, Configurations, and Suppression States
Compound Note
ComVisibleAttribute in VSTA macros
Controls, Visual Basic 6.0, and Windows XP
Expand Double Arrays and Integer PairsDouble Arrays and Integer Pairs
Drawing Views and Model Entities
Early and Late Binding
Expand EventsEvents
Features of Components
Helper Functions
Hole Wizard Features and Objects
IDispatch Object Arrays as Input in .NET
Implementation Guidelines
Import and Export File Options
In-process Methods
Instantiate ActiveX Controls as Tabs
Interface Pointers
Keystrokes and Accelerator Keys
Library Features and Objects
Lightweight Components
Line Attributes for View::GetPolyLinesAndCurves
Line Weights
Long vs. Integer
Expand Macro FeaturesMacro Features
Mass Properties
Expand Multibody PartsMultibody Parts
Option Explicit Statement
Partition Rollback and API Handles
Persistent Reference IDs
Presentation Transforms
Expand PropertyManager PagesPropertyManager Pages
.NET Interop Assemblies
Quick Tips and Bubble ToolTips
Return Values
Expand SafeArraysSafeArrays
Selection Criteria
Selection Lists
Selections that Define Features
Setup Project to Distribute SolidWorks Add-in
Smart Pointers
SolidWorks Objects
Sorting Tables
STL Container Classes and Smart Pointers
Suspend Automatic Rebuilds
System Options and Document Properties
Tessellation and Edges
Tracking IDs
Expand Type LibrariesType Libraries
Unmanaged C++ and C++/CLI Code
VBA and SolidWorks x64
Examples and Projects
Expand SolidWorks API HelpSolidWorks API Help
Expand FeatureWorks API HelpFeatureWorks API Help
Expand SolidWorks Costing API HelpSolidWorks Costing API Help
Expand SolidWorks Document Manager API HelpSolidWorks Document Manager API Help
Expand SolidWorks Routing API HelpSolidWorks Routing API Help
Expand SolidWorks Simulation API HelpSolidWorks Simulation API Help
Expand SolidWorks Sustainability API HelpSolidWorks Sustainability API Help
Expand SolidWorks Toolbox API HelpSolidWorks Toolbox API Help
Expand SolidWorks Utilities API HelpSolidWorks Utilities API Help
Expand SolidWorks Workgroup PDM API HelpSolidWorks Workgroup PDM API Help
Expand eDrawings API HelpeDrawings API Help
Hide Table of Contents

Block Definitions and Block Instances


The ISketchBlockDefinition and ISketchBlockInstance interfaces replace the now obsolete and not supported IBlockDefinition and IBlockInstances interfaces.


Blocks have definitions and instances. You can use block definitions and block instances in:

  • parts and assemblies for laying out key design components in 2D, analyzing kinematic motion in 2D, analyzing tolerance stack-ups between mating parts or features, etc.

  • drawings for items that you use often, such as standard notes, title blocks, label positions, etc.

In parts and assemblies only, block instances appear in the FeatureManager design tree under sketch features. In drawings only, block definitions appear as features in the FeatureManager design tree.

Edits to block definitions apply to all blocks instances of the same block definition, but changes to block instances apply only to the selected block instance.

The ISketchManager interface includes methods for creating, inserting, getting, and editing block definitions and block instances.

Block definitions



Instead of using the now obsolete and not supported...

Create block definitions


- or -


- or -



Edit block definitions

ISketchManager::EditSketchBlock and ISketchManager::EndEditSketchBlock


Explode block definitions




Get block definitions in parts or assemblies


- or -

Traverse the FeatureManager design tree to get the sketch under which the block instance appears, get the block instance from the sketch using ISketch::GetSketchBlockInstances, and from the block instance get its block definition using ISketchBlockInstance::Definition



Get block definitions in drawings


- or -

Traverse the FeatureManager design tree to get the block and then use IFeature::GetSpecificFeature2


IDrawingDoc::GetBlockDefinition and IDrawingDoc::GetBlockDefinitions

Get notes in block definitions



Get sketch and sketch entities in block definitions

ISketchBlockDefinition::GetArcs, ISketchBlockDefinition::GetEllipses, ISketchBlockDefinition::GetLines, ISketchBlockDefinition::GetParabolas, ISketchBlockDefinition::GetSketch, ISketchBlockDefinition::GetSplines2, and ISketchBlockDefinition::GetUserPoints


Identify sketch block definitions ISketchBlockDefinition::GetFeature and IFeature::GetTypeName2

For example, in VBA:

Dim swFeature as SldWorks.Feature

Set swFeature = swSketchBlockDefinition.GetFeature

Debug.Print swFeature.Name & [" & swFeature.GetTypeName2 & "]"

swFeature.GetTypeName2 returns SketchBlockDef.


Link block definitions to files

ISketchBlockDefinition::FileName and ISketchBlockDefinition::LinkToFile

IBlockDefinition::GetExternalFileName, IBlockDefinition::GetUseExternalFile, IBlockDefinition::SetExternalFileName, and IBlockDefinition::SetUseExternalFile

Save block definitions to files




Block instances



Instead of using the now obsolete and not supported...

Edit block instances



Explode block instances



Get attributes and set attribute values for block instances

ISketchBlockInstance::GetAttributes, ISketchBlockInstance::GetAttributeValue, and ISketchBlockInstance::SetAttributeValue

IBlockInstance::GetAttributes, IBlockInstance::GetAttributeValue, and IBlockInstance::SetAttributeValue

Get block instances



Insert block instances



- or -


Examine ISketchManager, ISketchBlockDefinition, and ISketchBlockInstance to see all of the methods and properties available for blocks. See the SolidWorks Help for additional details about blocks.




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

Subject:   Feedback on Help Topics
Page:   Block Definitions and Block Instances
*   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:


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

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.