InsertBlock2 Method (ISketchManager)

InsertBlock2 Method (ISketchManager) | Send Feedback
See Also Example

Blk[out]
  Block instance

BlockName
  Name for the Block instance

InsertX
  x coordinate where to insert the Block instance

InsertY
  y coordinate where to insert the Block instance

InsertZ
  z coordinate where to insert the Block instance

ScaleX
  Scale factor for the x axis

ScaleY
  Scale factor for the y axis

ScaleZ
  Scale factor for the z axis

Rotation
  Angle, in radians, by which to rotate the Block instance (see Remarks)

Inserts a Block instance.

# Syntax

Visual Basic |
--- | ---
    Function InsertBlock2( _
       ByVal BlockName As System.String, _
       ByVal InsertX As System.Double, _
       ByVal InsertY As System.Double, _
       ByVal InsertZ As System.Double, _
       ByVal ScaleX As System.Double, _
       ByVal ScaleY As System.Double, _
       ByVal ScaleZ As System.Double, _
       ByVal Rotation As System.Double _
    ) As BlockInstance

C# |
--- | ---
    BlockInstance InsertBlock2(
       System.string BlockName,
       System.double InsertX,
       System.double InsertY,
       System.double InsertZ,
       System.double ScaleX,
       System.double ScaleY,
       System.double ScaleZ,
       System.double Rotation
    )

JavaScript |
--- | ---
    InsertBlock2(
       BlockName : String,
       InsertX : Number,
       InsertY : Number,
       InsertZ : Number,
       ScaleX : Number,
       ScaleY : Number,
       ScaleZ : Number,
       Rotation : Number
    ) : dsBlockInstance

COM native C++ |
--- | ---
    HRESULT InsertBlock2(
       BSTR BlockName,
       DOUBLE InsertX,
       DOUBLE InsertY,
       DOUBLE InsertZ,
       DOUBLE ScaleX,
       DOUBLE ScaleY,
       DOUBLE ScaleZ,
       DOUBLE Rotation,
       IBlockInstance** Blk
    )

C++ |
--- | ---
    DSRESULT InsertBlock2(
       const dsString& BlockName,
       double InsertX,
       double InsertY,
       double InsertZ,
       double ScaleX,
       double ScaleY,
       double ScaleZ,
       double Rotation,
       dsBlockInstance** Blk
    )

#### Parameters

BlockName
  Name for the Block instance
InsertX
  x coordinate where to insert the Block instance
InsertY
  y coordinate where to insert the Block instance
InsertZ
  z coordinate where to insert the Block instance
ScaleX
  Scale factor for the x axis
ScaleY
  Scale factor for the y axis
ScaleZ
  Scale factor for the z axis
Rotation
  Angle, in radians, by which to rotate the Block instance (see Remarks)
Blk[out] or Return Value
  Block instance

# Example

This code snippet shows how to insert a Block instance.

#### COM native C++

> //Insert the existing Block instance or insert Block instance from a DWG file

> bstr_t blockFileName ( L"<path_and_DWG_file_name_OR_existing_Block_name>" );

> double insertX = 0, insertY = 0, insertZ = 0, scaleX = 1, scaleY = 1, scaleZ = 1, rotation = 0;

> BlockInstancePtr blockInstance = sketchMgr->InsertBlock2( blockFileName, insertX, insertY, insertZ, scaleX, scaleY, scaleZ, rotation );

# Example

Insert Block Instance (C#)
Insert Block Instance (VB.NET)
Insert Block Instance (VBA)
Insert Block, Notes, and Sketch Entities (JavaScript)

# Remarks

Before calling this method, you can call ICommandMessage::PromptForBlockInsertion if you want to prompt the user to specify how to insert the Block instance.

Use a positive value for Rotation to rotate the Block instance counterclockwise and a negative value to rotate the Block instance clockwise.

# See Also

####

ISketchManager Interface
ISketchManager Members

# Availability

DraftSight V1R2.1