|
发表于 2002-9-14 10:32:00
|
显示全部楼层
创建图层设置颜色的程序(delphi4.0,acad14.01)
unit uint1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,comobj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
acad,ac,act,mdp,lay:OleVariant;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
acad:= GetActiveOleObject('AutoCAD.Application');
// acad:= CreateOleObject('AutoCAD.Application');
acad.Visible := True;
ac:=acad.activedocument;
mdp :=ac.modelspace;
lay:=ac.layers.add('asf');//创建名为ASF的图层
lay.Color := 1 ; //设图层的颜色为红色
end;
end. |
|