Product : Engine, Version : 5.0.0.1033, ArticleID : 41023682

HowTo : Entities of a block don't take handles after copying a block in another instance of VectorDraw.

Article41023682
TypeHowTo
ProductEngine
Version5.0.0.1033
Date Added8/30/2004
Submitted byStephane Decarie
Keywords

Subject

Entities of a block don't take handles after copying a block in another instance of VectorDraw.

Summary

We have a block with some entities.These entities have handles.

After this code
vBlock = VDrawPro1.ActiveDocument.Blocks.FindName(sBlockName);
VDrawPro2.ActiveDocument.Blocks.AddItem(vBlock.Copy());
where vblock is added in VdrawPro2 , the entities in the block in VdrawPro2 do not take handles(the handles are empty).
After inserting the block in VDrawPro2 they do not take handles.

Solution

With copy you may encounter problems when the block has text with textstyles diferrent than standard or dimensions etc... The best way to do this is to save the block in a file with CmdWriteBlock and then insert the block in the other VectorDraw control.
    vdrawpro1.ActiveDocument.Open ""
    Dim vBlock As vdBlock
    Set vBlock = vdrawpro1.ActiveDocument.Blocks.FindName("la")
    
    vdrawpro1.CommandAction.CmdWriteBlock "la", Array(0, 0), App.Path + "\myblock.vdf"
    vdrawpro2.ActiveDocument.Blocks.AddFromFile App.Path + "\myblock.vdf", True
    vdrawpro2.ActiveDocument.Entities.InsertBlock Array(0, 0), "myblock", 1, 1, 0
    vdrawpro2.CommandAction.Zoom "E", 0, 0