<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Delphi - OleVariant a pointer in D6? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063816#M52999</link>
    <description>FWIW,
If you're only interested in spheres, you can calculate the position where
the two are just touching.  For the direction you're moving the second
sphere in, it would be:

' r1 and r2 are the two spheres' radii
dx = (r1 + r2) / sqrt(3)
dy = dx
dz = dx

p2[0] = p1[0] + dx
p2[1] = p1[1] + dy
p2[2] = p1[2] + dz

If you try this and it doesn't give the right answer, let me know and I'll
re-do my math.

James</description>
    <pubDate>Tue, 22 Jun 2004 14:03:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2004-06-22T14:03:47Z</dc:date>
    <item>
      <title>Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063815#M52998</link>
      <description>Hello All,&lt;BR /&gt;
&lt;BR /&gt;
I create 2 spheres and then move the second until there is no more interference between the two. Keeping track of the new coordintes.&lt;BR /&gt;
following code works fine in Delphi 5:&lt;BR /&gt;
&lt;BR /&gt;
procedure TForm1.Button1Click(Sender: TObject);&lt;BR /&gt;
var&lt;BR /&gt;
  AcadApp: AcadApplication;&lt;BR /&gt;
  Drawing: AcadDocument;&lt;BR /&gt;
  MSpace : AcadModelSpace;&lt;BR /&gt;
&lt;BR /&gt;
  p1      : OleVariant;&lt;BR /&gt;
  p2      : OleVariant;&lt;BR /&gt;
  Sphere1      : Acad3DSOlid;&lt;BR /&gt;
  Sphere2      : Acad3DSolid;&lt;BR /&gt;
  Intersection : Acad3DSOlid;&lt;BR /&gt;
  Interference : Boolean;&lt;BR /&gt;
begin&lt;BR /&gt;
  AcadApp := GetAcadApplication(True);&lt;BR /&gt;
  MSpace  := AcadApp.ActiveDocument.ModelSpace;&lt;BR /&gt;
&lt;BR /&gt;
  // Create point arrays&lt;BR /&gt;
  p1 := VarArrayCreate([0,2], varDouble);&lt;BR /&gt;
  p2 := VarArrayCreate([0,2], varDouble);&lt;BR /&gt;
&lt;BR /&gt;
  // assign values to points&lt;BR /&gt;
  p1[0] := 0.0; p1[1] := 0.0; p1[2] := 0.0;&lt;BR /&gt;
  p2    := p1;&lt;BR /&gt;
&lt;BR /&gt;
  // Create 3DSolid opbjects&lt;BR /&gt;
  Sphere1 := MSpace.AddSphere(p1,5);&lt;BR /&gt;
  Sphere2 := MSpace.AddSphere(p2,5);&lt;BR /&gt;
  Interference:=True;&lt;BR /&gt;
&lt;BR /&gt;
  // Move Sphere2 until there is no interference&lt;BR /&gt;
  while Interference do&lt;BR /&gt;
  begin&lt;BR /&gt;
    Intersection:=Sphere1.CheckInterference(Sphere2,true);&lt;BR /&gt;
    if Intersection=nil then&lt;BR /&gt;
      Interference:=false&lt;BR /&gt;
    else&lt;BR /&gt;
      begin&lt;BR /&gt;
        // Delete created intersection&lt;BR /&gt;
        Intersection.Delete;&lt;BR /&gt;
        // Intersection:=nil;&lt;BR /&gt;
        p1:=p2;&lt;BR /&gt;
        // Calculate new coordinates for Sphere2&lt;BR /&gt;
        p2[0]:=p2[0]+0.1;&lt;BR /&gt;
        p2[1]:=p2[1]+0.1;&lt;BR /&gt;
        p2[2]:=p2[2]+0.1;&lt;BR /&gt;
        // Move Sphere2&lt;BR /&gt;
        Sphere2.Move(p1,p2);&lt;BR /&gt;
        Sphere2.Update;&lt;BR /&gt;
        p1:=p2;&lt;BR /&gt;
      end;&lt;BR /&gt;
  end;&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
In Delphi 6 however, a change to p1 or p2 has the same effect on the other.&lt;BR /&gt;
&lt;BR /&gt;
Is D5 behaviour correct or is D6?&lt;BR /&gt;
&lt;BR /&gt;
Are there samples of AcadX use in Delphi? The links to samples in the "What's New" section on Tony's site seem to be broken...&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Jack</description>
      <pubDate>Tue, 22 Jun 2004 06:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063815#M52998</guid>
      <dc:creator>JackHouben</dc:creator>
      <dc:date>2004-06-22T06:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063816#M52999</link>
      <description>FWIW,
If you're only interested in spheres, you can calculate the position where
the two are just touching.  For the direction you're moving the second
sphere in, it would be:

' r1 and r2 are the two spheres' radii
dx = (r1 + r2) / sqrt(3)
dy = dx
dz = dx

p2[0] = p1[0] + dx
p2[1] = p1[1] + dy
p2[2] = p1[2] + dz

If you try this and it doesn't give the right answer, let me know and I'll
re-do my math.

James</description>
      <pubDate>Tue, 22 Jun 2004 14:03:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063816#M52999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-06-22T14:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063817#M53000</link>
      <description>I compiled/ran this in D7. The values of P2 did not change after changing the values of P1.&lt;BR /&gt;
[pre]&lt;BR /&gt;
procedure TForm1.Button1Click(Sender: TObject);&lt;BR /&gt;
var&lt;BR /&gt;
  P1: OleVariant;&lt;BR /&gt;
  P2: OleVariant;&lt;BR /&gt;
  Msg: string;&lt;BR /&gt;
begin&lt;BR /&gt;
  P1 := VarArrayCreate([0,2], varDouble);&lt;BR /&gt;
  P2 := VarArrayCreate([0,2], varDouble);&lt;BR /&gt;
&lt;BR /&gt;
  P1[0] := 10.0;&lt;BR /&gt;
  P1[1] := 10.0;&lt;BR /&gt;
  P1[2] := 10.0;&lt;BR /&gt;
&lt;BR /&gt;
  P2 := P1;&lt;BR /&gt;
&lt;BR /&gt;
  Msg := IntToStr(P2[0]) + ', ' + IntToStr(P2[1]) + ', ' + IntToStr(P2[2]);&lt;BR /&gt;
  MessageDlg(Msg, mtInformation, [mbOK], 0);&lt;BR /&gt;
&lt;BR /&gt;
  P1[0] := 20.0;&lt;BR /&gt;
  P1[1] := 20.0;&lt;BR /&gt;
  P1[2] := 20.0;&lt;BR /&gt;
&lt;BR /&gt;
  Msg := IntToStr(P2[0]) + ', ' + IntToStr(P2[1]) + ', ' + IntToStr(P2[2]);&lt;BR /&gt;
  MessageDlg(Msg, mtInformation, [mbOK], 0);&lt;BR /&gt;
  Application.Terminate;&lt;BR /&gt;
end;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 22 Jun 2004 14:55:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063817#M53000</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-06-22T14:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063818#M53001</link>
      <description>Thanks James,

I'm taking my first steps in ActiveX and AutoCad, your math is correct, but
my spheres where just 2  solids that look nice!
Delphi 5 seems to be ok and Jackrabbit points out Delphi7 is too. So I will
have to get me D7...or work arround in D6

Thanks for your reaction!




"James Belshan" &lt;JLBELSHAN&gt; schreef in bericht
news:40d83c43$1_2@newsprd01...
&amp;gt; FWIW,
&amp;gt; If you're only interested in spheres, you can calculate the position where
&amp;gt; the two are just touching.  For the direction you're moving the second
&amp;gt; sphere in, it would be:
&amp;gt;
&amp;gt; ' r1 and r2 are the two spheres' radii
&amp;gt; dx = (r1 + r2) / sqrt(3)
&amp;gt; dy = dx
&amp;gt; dz = dx
&amp;gt;
&amp;gt; p2[0] = p1[0] + dx
&amp;gt; p2[1] = p1[1] + dy
&amp;gt; p2[2] = p1[2] + dz
&amp;gt;
&amp;gt; If you try this and it doesn't give the right answer, let me know and I'll
&amp;gt; re-do my math.
&amp;gt;
&amp;gt; James
&amp;gt;
&amp;gt;
&amp;gt;&lt;/JLBELSHAN&gt;</description>
      <pubDate>Tue, 22 Jun 2004 18:06:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063818#M53001</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-06-22T18:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063819#M53002</link>
      <description>Hallo Jackrabbi,

I dit the same in D5 and D6. D5 worked ok, for D6 I now have a workaround. I
was just curious which one was correct.

Last part of my message...
Are there samples of AcadX use in Delphi? The links to samples in the
"What's New" section on Tony's site seem to be broken..

Have you any idea or samples?

Thanks in advance!

jack

"Jackrabbit" &lt;NOSPAM&gt; schreef in bericht
news:12594185.1087916165524.JavaMail.jive@jiveforum1...
&amp;gt; I compiled/ran this in D7. The values of P2 did not change after changing
the values of P1.
&amp;gt; [pre]
&amp;gt; procedure TForm1.Button1Click(Sender: TObject);
&amp;gt; var
&amp;gt;   P1: OleVariant;
&amp;gt;   P2: OleVariant;
&amp;gt;   Msg: string;
&amp;gt; begin
&amp;gt;   P1 := VarArrayCreate([0,2], varDouble);
&amp;gt;   P2 := VarArrayCreate([0,2], varDouble);
&amp;gt;
&amp;gt;   P1[0] := 10.0;
&amp;gt;   P1[1] := 10.0;
&amp;gt;   P1[2] := 10.0;
&amp;gt;
&amp;gt;   P2 := P1;
&amp;gt;
&amp;gt;   Msg := IntToStr(P2[0]) + ', ' + IntToStr(P2[1]) + ', ' +
IntToStr(P2[2]);
&amp;gt;   MessageDlg(Msg, mtInformation, [mbOK], 0);
&amp;gt;
&amp;gt;   P1[0] := 20.0;
&amp;gt;   P1[1] := 20.0;
&amp;gt;   P1[2] := 20.0;
&amp;gt;
&amp;gt;   Msg := IntToStr(P2[0]) + ', ' + IntToStr(P2[1]) + ', ' +
IntToStr(P2[2]);
&amp;gt;   MessageDlg(Msg, mtInformation, [mbOK], 0);
&amp;gt;   Application.Terminate;
&amp;gt; end;
&amp;gt; [/pre]&lt;/NOSPAM&gt;</description>
      <pubDate>Tue, 22 Jun 2004 18:08:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063819#M53002</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-06-22T18:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Delphi - OleVariant a pointer in D6?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063820#M53003</link>
      <description>I don't see anything in your code that would suggest a problem.

I do advise you to get rid of Delphi 6 and get Delphi 7.  Delphi 6
has problems with type library import.

-- 
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com

AutoCAD based Security Planning Solutions:
http://www.caddzone.com/securityplanning

"Jack Houben" &lt;NOSPAM&gt; wrote in message
news:17231714.1087886602297.JavaMail.jive@jiveforum2.autodesk.com...
&amp;gt; Hello All,
&amp;gt;
&amp;gt; I create 2 spheres and then move the second until there is no more interference between the two. Keeping track of the
new coordintes.
&amp;gt; following code works fine in Delphi 5:
&amp;gt;
&amp;gt; procedure TForm1.Button1Click(Sender: TObject);
&amp;gt; var
&amp;gt;   AcadApp: AcadApplication;
&amp;gt;   Drawing: AcadDocument;
&amp;gt;   MSpace : AcadModelSpace;
&amp;gt;
&amp;gt;   p1      : OleVariant;
&amp;gt;   p2      : OleVariant;
&amp;gt;   Sphere1      : Acad3DSOlid;
&amp;gt;   Sphere2      : Acad3DSolid;
&amp;gt;   Intersection : Acad3DSOlid;
&amp;gt;   Interference : Boolean;
&amp;gt; begin
&amp;gt;   AcadApp := GetAcadApplication(True);
&amp;gt;   MSpace  := AcadApp.ActiveDocument.ModelSpace;
&amp;gt;
&amp;gt;   // Create point arrays
&amp;gt;   p1 := VarArrayCreate([0,2], varDouble);
&amp;gt;   p2 := VarArrayCreate([0,2], varDouble);
&amp;gt;
&amp;gt;   // assign values to points
&amp;gt;   p1[0] := 0.0; p1[1] := 0.0; p1[2] := 0.0;
&amp;gt;   p2    := p1;
&amp;gt;
&amp;gt;   // Create 3DSolid opbjects
&amp;gt;   Sphere1 := MSpace.AddSphere(p1,5);
&amp;gt;   Sphere2 := MSpace.AddSphere(p2,5);
&amp;gt;   Interference:=True;
&amp;gt;
&amp;gt;   // Move Sphere2 until there is no interference
&amp;gt;   while Interference do
&amp;gt;   begin
&amp;gt;     Intersection:=Sphere1.CheckInterference(Sphere2,true);
&amp;gt;     if Intersection=nil then
&amp;gt;       Interference:=false
&amp;gt;     else
&amp;gt;       begin
&amp;gt;         // Delete created intersection
&amp;gt;         Intersection.Delete;
&amp;gt;         // Intersection:=nil;
&amp;gt;         p1:=p2;
&amp;gt;         // Calculate new coordinates for Sphere2
&amp;gt;         p2[0]:=p2[0]+0.1;
&amp;gt;         p2[1]:=p2[1]+0.1;
&amp;gt;         p2[2]:=p2[2]+0.1;
&amp;gt;         // Move Sphere2
&amp;gt;         Sphere2.Move(p1,p2);
&amp;gt;         Sphere2.Update;
&amp;gt;         p1:=p2;
&amp;gt;       end;
&amp;gt;   end;
&amp;gt; end;
&amp;gt;
&amp;gt; In Delphi 6 however, a change to p1 or p2 has the same effect on the other.
&amp;gt;
&amp;gt; Is D5 behaviour correct or is D6?
&amp;gt;
&amp;gt; Are there samples of AcadX use in Delphi? The links to samples in the "What's New" section on Tony's site seem to be
broken...
&amp;gt;
&amp;gt; Thanks,
&amp;gt; Jack&lt;/NOSPAM&gt;</description>
      <pubDate>Tue, 22 Jun 2004 18:22:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/delphi-olevariant-a-pointer-in-d6/m-p/1063820#M53003</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-06-22T18:22:02Z</dc:date>
    </item>
  </channel>
</rss>

