Board index » delphi » passing array to Autocad ActiveX Automation ?

passing array to Autocad ActiveX Automation ?

Hello,

I'm trying to write a program for Autocad with delphi by using the Autocad
ActiveX automation.

The problem with Delphi is that it not accept arrays as parameters for
automation methods.

Is there anyone that knows a trick to do this ???

 

Re:passing array to Autocad ActiveX Automation ?


Chris,

I've done quite a bit of passing info between ACAD and Delphi.  What,
specifically, are you trying to do?  Sending an array of point
coordinates?

It sounds like you're dealing with something for which variant arrays
might be applicable.  You'll need to somehow copy the values from your
Delphi variables/arrays into variant arrays.  One sample usage of
varaint arrays is below:

var x1,y1,z1,x2,y2,z2: double;

var P1, P2: OleVariant;
begin
  P1:= VarArrayCreate([0,2], VT_R8);
  P2:= VarArrayCreate([0,2], VT_R8);
  P1[0]:= x1;
  P1[1]:= y1;
  P1[2]:= z1
  P2[0]:= x2;
  P2[1]:= y2;
  P2[2]:= z2;
  if getAutoCADversion<15 then
  begin   // ACAD14
    ADoc_OLE.ActiveViewPort.ZoomWindow(VarArrayRef(P1),VarArrayRef(P2));
  end
  else begin   // ACAD2000
     ACad_OLE.ZoomWindow(P1,P2);
  end;
end;

In article <7pb9sk$ek...@news.planetinternet.be>,
  "Chris Demuynck" <Chris.Demuy...@Advalvas.be> wrote:

Quote
> Hello,

> I'm trying to write a program for Autocad with delphi by using the
Autocad
> ActiveX automation.

> The problem with Delphi is that it not accept arrays as parameters for
> automation methods.

> Is there anyone that knows a trick to do this ???

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Other Threads