Delphi Application and AutoCAD 2002

Discussion in 'AutoCAD' started by Keven Corazza, Feb 20, 2004.

  1. Hi, I've develope a little Delphi Application that open AutoCAD 2002 and
    insert two lines. In my PC all works fine. In another PC where AutoCAD 2002
    is installed the application is able to open AutoCAD but, when I try to
    insert the line I get the following error:

    Class not registered.

    Any ideas?

    Thank you in advance.

    Regards.

    Keven Corazza
    SierraSoft
     
    Keven Corazza, Feb 20, 2004
    #1
  2. Tony Tanzillo, Feb 20, 2004
    #2
  3. This is my code:

    type
    TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    private
    AcadApp: IAcadApplication;

    function TestAcadAvailable: Boolean;
    function RunAutoCad: Boolean;
    procedure AddLines;
    end;

    ....

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if RunAutoCad(False) then
    AddLines;
    end;

    function TForm1.TestAcadAvailable: Boolean;
    begin
    Result:=True;
    try
    AcadApp:=GetActiveOleObject('AutoCAD.Application.15') as
    IAcadApplication;
    // is 'AutoCAD.Application.15' correct ?
    except
    AcadApp:=nil;
    Result:=False;
    end;
    end;

    function TForm1.RunAutoCad: Boolean;
    begin
    AcadApp:=nil;

    Screen.Cursor:=crHourGlass;
    if not(TestAcadAvailable) then
    begin
    AcadApp:=CreateOleObject('AutoCAD.Application.15') as
    IAcadApplication;
    // AcadApp:=CoAcadApplication.Create;
    AcadApp.Visible:=True;
    Application.BringToFront;
    end;
    Screen.Cursor:=crDefault;

    if AcadApp<>nil then
    begin
    if AcadApp.Documents.Count=0 then
    AcadApp.Documents.Add('');
    Result:=True;
    end
    else
    Result:=False;
    end;

    procedure TForm1.AddLines;
    var
    p1,p2,p3,p4: OleVariant;
    begin
    p1:=VarArrayCreate( [0, 2], varDouble );
    p1[0]:=0;
    p1[1]:=0;
    p1[2]:=0;
    p2:=VarArrayCreate( [0, 2], varDouble );
    p2[0]:=50;
    p2[1]:=50;
    p2[2]:=50;
    p3:=VarArrayCreate( [0, 2], varDouble );
    p3[0]:=0;
    p3[1]:=50;
    p3[2]:=0;
    p4:=VarArrayCreate( [0, 2], varDouble );
    p4[0]:=50;
    p4[1]:=0;
    p4[2]:=0;

    AcadApp.ActiveDocument.Database.ModelSpace.AddLine(p1,p2);
    AcadApp.ActiveDocument.Database.ModelSpace.AddLine(p3,p4);
    AcadApp.ZoomExtents;
    end;

    Thank you in advance.

    Regards.

    Keven Corazza
    SierraSoft
     
    Keven Corazza, Feb 21, 2004
    #3
  4. Tony Tanzillo, Feb 21, 2004
    #4
  5. I get the error when the software execute the AddLine method.

    Thank you in advance.

    Keven Corazza
    SierraSoft
     
    Keven Corazza, Feb 23, 2004
    #5
  6. Tony Tanzillo, Feb 23, 2004
    #6
  7. Keven Corazza

    Joe Sutphin Guest

    Trying changing the following 2 lines

    AcadApp.ActiveDocument.Database.ModelSpace.AddLine(p1,p2);
    AcadApp.ActiveDocument.Database.ModelSpace.AddLine(p3,p4);

    to be this

    AcadApp.ActiveDocument.ModelSpace.AddLine(p1,p2);
    AcadApp.ActiveDocument.ModelSpace.AddLine(p3,p4);
     
    Joe Sutphin, Feb 23, 2004
    #7
  8. Tony Tanzillo, Feb 24, 2004
    #8
  9. Keven Corazza

    Joe Sutphin Guest

    Joe Sutphin, Feb 25, 2004
    #9
  10. I've tried but the problem is the same. The strange thing is that in other
    Acad 2002 the sofware works. Can be related to other application (ARX, LISP,
    ....) that AutoCAD load ?

    Keven Corazza
    SierraSoft
     
    Keven Corazza, Feb 25, 2004
    #10
  11. Tony Tanzillo, Feb 25, 2004
    #11
  12. Like I said, this has to be an OLE registration
    problem. Have you used any registry cleaners?

    My advice is to reinstall AutoCAD, and also try
    it on other systems if you can. Also, what version
    of Delphi are you using?



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
     
    Tony Tanzillo, Feb 25, 2004
    #12
  13. I'm quite sure, looking your experience on this field, that you are right.
    The problem is that I've tried on five PC, three works two doesn't work. The
    two where I have the problem belongs to one of my customers and they have a
    lot of application that runs on them.

    You know that with the new policy by Autodesk install AutoCAD means that you
    have to ask the installation code and all this request are recorded.

    Is there a way to repeat the ole registration without install autocad from
    the beginning ?

    Thank you for your help

    Keven Corazza
    SierraSoft
     
    Keven Corazza, Feb 26, 2004
    #13
  14. I'm not sure what you mean by 'ask the installation code
    and all this request are recorded'.

    You can do a repair of the existing installation without
    having to enter anything.

    I don't know if Autodesk broke out the registration
    from the installer. Also, if there are lots of other
    applications installed on the customer's system, then
    that could be an indication of other problems as well.

    For example, I've seen the use of Visual LISP's LDATA
    completely hose AutoCAD registry information.



    AcadX for AutoCAD 2004 Beta 1
    http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
     
    Tony Tanzillo, Feb 26, 2004
    #14
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.