Product : Engine, Version : 5.1.1.1041, ArticleID : 41024247

HowTo : Get the entities after exploding the vdInsert (block) in Delphi

Article41024247
TypeHowTo
ProductEngine
Version5.1.1.1041
Date Added6/15/2006
Submitted bySnape Computers Ltd
Keywords

Subject

Get the entities after exploding the vdInsert (block) in Delphi

Summary

I am using Delphi with the VectorDraw component. I need to explode a vdInsert and need to know what form the returned OleVaraint is. Also any code examples would be much appreciated.

Solution

Try a code like this (new project with a form, a button and a vdraw control in it) with the attached drawing :
procedure TForm1.Button5Click(Sender: TObject);
Type Tfig = array of vdfigure;
 
Var ins : vdInsert;
    i : integer;
    fig : vdFigure;
    aExpl: Tfig;
 
begin
  vdraw.ActiveDocument.Open('C:\TESTS\VectorDraw.vdi',0,0);
  //the drawing contains a vdInsert object with Handle : "1A"
  ins  := vdraw.ActiveDocument.GetFromHandle('1A') as vdinsert; //Get the insert
  aExpl := ins.Explode(False); //Explode it and get the array of the figures that contained in the vdInsert
  for i:=0 to High(aExpl) do // Get each entity vdFigure in the array
     begin
        fig:=aExpl[i] as vdfigure;
        fig.HighLight:=1; // Highlight it
        fig.Invalidate;  // and redraw it
     end;
end;