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
To... |
Use... |
Instead of using the now obsolete and not
supported... |
Create block definitions |
ISketchManager::MakeSketchBlockFromFile
- or -
ISketchManager::MakeSketchBlockFromSelected
- or -
ISketchManager::MakeSketchBlockFromSketch |
IDrawingDoc::MakeBlockDefinition |
Edit block definitions |
ISketchManager::EditSketchBlock
and ISketchManager::EndEditSketchBlock |
IDrawingDoc::GetEditBlock |
Explode block definitions
|
ISketchManager::ExplodeSketchBlockInstance |
IDrawingDoc::ExplodeBlockInstance |
Get block definitions in parts
or assemblies |
ISketchManager::GetSketchBlockDefinitions
- 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
|
None |
Get block definitions in drawings |
ISketchManager::GetSketchBlockDefinitions
- 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 |
ISketchBlockDefinition::GetNotes |
IBlockDefinition::GetNotes |
Get sketch and sketch entities in block definitions |
ISketchBlockDefinition::GetArcs,
ISketchBlockDefinition::GetEllipses,
ISketchBlockDefinition::GetLines,
ISketchBlockDefinition::GetParabolas,
ISketchBlockDefinition::GetSketch,
ISketchBlockDefinition::GetSplines2,
and
ISketchBlockDefinition::GetUserPoints |
IBlockDefinition::GetSketch |
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. |
None |
Link block definitions to files |
ISketchBlockDefinition::FileName
and ISketchBlockDefinition::LinkToFile |
IBlockDefinition::GetExternalFileName, IBlockDefinition::GetUseExternalFile,
IBlockDefinition::SetExternalFileName, and IBlockDefinition::SetUseExternalFile |
Save block definitions to files |
ISketchBlockDefinition::Save |
IDrawingDoc::SaveBlock |
Block instances
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.