Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AutoCAD

57 views
Skip to first unread message

JJ

unread,
Dec 7, 1999, 3:00:00 AM12/7/99
to
Does anyone have any experience linking Delphi with AutoCAD? I looked at
the documentation in AutoCAD 14 for OLE Automation and it seemed to hint
that the only language capable of linking with AutoCAD was Visual Basic
(*gulp*). I know you can work using AutoLISP but was hoping to avoid that.

thanks,

JJ

Todd R. Palmer

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to

You can easily work with autocad w/ delphi using OLE automation. In
fact inprise's David I did a little story on it:

http://community.borland.com/article/0,1410,10194,00.html

todd
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The more I learn, the less I know.
This could take forever.

Todd Palmer
Developer
CallCenter Technology Inc.
todd....@CallCti.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Marc Nederhoff

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Hi JJ

Take a look at http://ourworld.compuserve.com/homepages/tonyt. It is very
usefull!

Marc

Klaus Burgstaller

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Hi JJ

> Does anyone have any experience linking Delphi with AutoCAD? I looked at
> the documentation in AutoCAD 14 for OLE Automation and it seemed to hint
> that the only language capable of linking with AutoCAD was Visual Basic
> (*gulp*). I know you can work using AutoLISP but was hoping to avoid that.
>

> thanks,
>
> JJ

What do you exactly want to do with AutoCAD?
I'm currently working with AutoCAD and Delphi using OLE-Automation.
So I'm sure I can help you.
Explain your problem!

C U
Burgi


JJ

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
I need to automate some simple part drawings in AutoCAD. If you could tell
me how to establish a link so that I can simply draw a circle or something,
I believe I can take it from there. I don't know where the ACAD OLE object
code is and how to use it. (I know how to work with Excel, but I'm lacking
that link to AutoCAD).

If you could briefly outline the steps (including locating the type
library)...

Thank you VERY much, this is a small but quite powerful segment of Delphi
programming, and finding help is tough.

thanx,

JJ


Klaus Burgstaller <klaus.bu...@netway.at> wrote in message
news:384E97DD...@netway.at...

Sascha Krüning

unread,
Dec 9, 1999, 3:00:00 AM12/9/99
to
ACAD.TLB needs to be registered. If it isn't, use REGSVR32.Exe. But it
should be registered! The TLB file is in the AutoCAD folder.

Import the Type Library from within the Delphi IDE:
Project|Import Type Library... select AutoCAD Object Library
or add ACAD.TLB by pressing then [Add...] button

Add to the uses clause in your Delphi code:
AutoCAD_TLB, ComObj

Then sample draws a line in color blue.

const acBlue = 5; // Const taken from VBA Objectbrowser

procedure TForm1.Button1Click(Sender: TObject);
var
Linie : AcadLine;
acd : variant;
acad : AcadApplication;
doc : AcadDocument;
begin
try
acd := GetActiveOleObject('AutoCAD.Application.14');
except
ShowMessage('AutoCAD is not started!');
exit;
end;
doc := IDispatch(Acd.ActiveDocument) as AcadDocument;

// access AutoCAD Application. Not necessary, just
// here for demonstration
acad := doc.Application_;

doc := acad.ActiveDocument ;

Linie := doc.ModelSpace.AddLine (Mkpt(10,10,0),MkPt(20,12.5,0));
Linie.Color := acBlue;

caption := doc.Name ;
acad.Visible := True;

end;
function TForm1.MkPt(x,y,z : double):OleVariant;
begin
result := VarArrayCreate ([0,2],varDouble);
result[0] := x;
result[1] := y;
result[2] := z;
end;

Hope this helps

Sascha
JJ wrote in message <82jp28$1m...@forums.borland.com>...

0 new messages