各位大哥,怎么样在delphi中嵌入AutoCAD?(100分)

  • 主题发起人 主题发起人 zdwjetlee
  • 开始时间 开始时间
Z

zdwjetlee

Unregistered / Unconfirmed
GUEST, unregistred user!
也就是怎么样才能在窗体里直接编辑AutoCAD文件,怎么把程序和AutoCAD关联起来?
 
问题: 请可否用Delphi使用SDK? 如AutoCad的SDK. ( 积分: 50 )
分类: 非技术问题

来自: xwings, 时间: 2001-02-14 21:53:32, ID: 454855
还有3dsMax的SDK.
如果想开发3dsMax的插件的话,要用他的SDK,可是里面都是C++的头文件*.h 和*.lib

请问可否用Delphi开发?

如何转化*.h 和*.lib为Delphi所用?



来自: douh, 时间: 2001-02-14 22:47:18, ID: 454870
关键是要把.h文件翻译成DELPHI的*.pas,以提供接口,不容易啊!

来自: devuser, 时间: 2001-02-14 23:41:54, ID: 454900
Delphi能够通过ActiveX Automation技术控制AutoCAD

来自: Pipi., 时间: 2001-02-14 23:46:04, ID: 454903
使用其他产品的sdk,用c++是比较方便的,delphi在这方面是个弱点

来自: xwings, 时间: 2001-02-15 11:32:24, ID: 455135
头文件*.h好像有工具转换的吧.

但不知*.lib如何在Delphi中用?


来自: 吕雪松, 时间: 2001-02-15 12:07:21, ID: 455163
<b>Using Delphi with Autocad</b>
Opening and zooming in an Autocad document from a Delphi application
Uploader: Steven van Els
Company: Staatsolie Refinery Reference: N/A

Question/Problem/Abstract:
I have an Industrial database application in Delphi with several equipment. Also I have a plant layout in Autocad, and several Process Flow Diagrams (PFD) also in Autocad.

How can I show the location of the equipment or the PFD to the users?
Answer:
In this example we let Autocad start up, Open a file and zoom in to a desired location.
We will to this for Acad-14, and Acad-2000


We will need a form with a button, add the units ActiveX, ComObj and OleCtnrs.



unit AcadTest2000;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ActiveX, ComObj, OleCtnrs;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
p1, p2 : OleVariant;
Acad, ActiveDoc, : OleVariant;
begin
// create variant arrays to hold coordinates of the window
p1 := VarArrayCreate([0,2], VT_R8);
p2 := VarArrayCreate([0,2], VT_R8);

// assign values to array elements
p1[0] := 14330.0; p1[1] := 400.0; p1[2] := 0; //point (14330,400,0)
p2[0] := 26400.0; p2[1] := 8500.0; p2[2] := 0; //point (26400,8500,0)

Acad := CreateOleObject('AutoCad.Application');
if not varisempty(Acad) then
Acad.visible := visible;

// open drawing
ActiveDoc := Acad.Documents.Open('E:/Home/Planview.dwg');

// zoom appliciation
Acad.ZoomExtents;
Acad.ZoomWindow(VarArrayRef(p1),VarArrayRef(p2));
end;

end.


The Approach for Acad-14 is different. The ZoomExtents and ZoomWindow methods apply to a viewport, also the sintaxe of opening a file is different
unit AcadTest14;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ActiveX, ComObj, OleCtnrs;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
p1, p2 : OleVariant;
Acad, ActiveDoc, ViewPort : OleVariant;
begin
// create variant arrays to hold coordinates of the window
p1 := VarArrayCreate([0,2], VT_R8);
p2 := VarArrayCreate([0,2], VT_R8);

// assign values to array elements
p1[0] := 14330.0; p1[1] := 400.0; p1[2] := 0; //point (14330,400,0)
p2[0] := 26400.0; p2[1] := 8500.0; p2[2] := 0; //point (26400,8500,0)

Acad := CreateOleObject('AutoCad.Application.14');
if not varisempty(Acad) then
Acad.visible := visible;

// open drawing
ActiveDoc := Acad.ActiveDocument.Open('E:/Home/Planview.dwg');

//Activate viewport
ViewPort := ActiveDoc.ActiveViewPort;

// zoom appliciation
ViewPort.ZoomExtents;
ViewPort.ZoomWindow(VarArrayRef(p1),VarArrayRef(p2));
end;

end.


来自: xwings, 时间: 2001-02-15 14:03:25, ID: 455255
看不太懂....



我主要想开发3dsMax..

她提供的SDK有很多Lib.不知如何用?


来自: 吕雪松, 时间: 2001-02-15 16:54:55, ID: 455363
已经告别第三软件SDK的年代挺久了,现在都是用OLE/COM/ActiveX的方式嵌入。

来自: midi, 时间: 2001-02-16 17:54:30, ID: 456003
关注此题

来自: 热血, 时间: 2001-02-16 17:59:11, ID: 456005
http://delphi-jedi.org
有转换工具

来自: 张卫锋, 时间: 2001-02-17 2:31:50, ID: 456235
3dsMax sdk中所带的LIB文件在DELPHI中无用,只要把*.h转换成*.pas文件,编译成DCU文件,
即可。一般用STDCALL调用,并且知道各函数在哪个DLL中。


来自: xwings, 时间: 2001-02-17 8:52:24, ID: 456317
多人接受答案了。

得分大富翁: devuser-5,Pipi.-5,吕雪松-10,热血-15,张卫锋-15,
 
接受答案了.
 
后退
顶部