delphi操作AutoCAD的问题

snakefire 2004-09-16 10:24:11
其实这个问题应该是autoCAD的问题,但是没有AutoCAD的板块,现在我是用delphi操作AutoCAD。。所只好到这里提问了,希望有AutoCAD开发经验的大虾们救命。。

autoCAD中,delphi操作怎么将块分解。。。Explode--是分解块的操作,但是我在调用Block时,
Block没有这个方法。
...全文
136 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
i54 2004-10-21
  • 打赏
  • 举报
回复
UP
WhyAndAnswer 2004-10-21
  • 打赏
  • 举报
回复
学习
yijiansong 2004-09-17
  • 打赏
  • 举报
回复
学习
太空11 2004-09-17
  • 打赏
  • 举报
回复
给你点代码,可能对你能有点帮助。
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.

zhengji 2004-09-17
  • 打赏
  • 举报
回复
要不就是 AutoCAD 的 Application 里有炸图块的函数。呵呵,机器上没资料,帮不了你了。

另:AutoCAD 的帮助里有关于它所提供的 ActiveX 的说明,楼主可参考一下。
zhengji 2004-09-17
  • 打赏
  • 举报
回复
我记得又一个函数表示直接给AutoCAD 输入命令的,选中 Block 后,通过该函数让AutoCAD 执行一下 "_explode" 即可。
sunkevin 2004-09-17
  • 打赏
  • 举报
回复
没用过

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧