VBA For AutoCAD为其它语言调用ACAD的一些功能提供了便利.
现小弟用CreateObject成功启动AutoCAD R14,但是如何继续使用却不得要领,请各位帮忙:
1、在VBA中有一个例子:
Sub Example_AddLine()
' This example adds a line in model space
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' Define the start and end points for the line
startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#
' Create the line in model space
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
ZoomAll
End Sub
请问如何转化为Delphi使用?
2、ObjectARX是专为VC而设计的,在Delphi或是BCB中能否使用?
3、还有其它方法可使Delphi调用ACAD吗?
现小弟用CreateObject成功启动AutoCAD R14,但是如何继续使用却不得要领,请各位帮忙:
1、在VBA中有一个例子:
Sub Example_AddLine()
' This example adds a line in model space
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' Define the start and end points for the line
startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#
' Create the line in model space
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
ZoomAll
End Sub
请问如何转化为Delphi使用?
2、ObjectARX是专为VC而设计的,在Delphi或是BCB中能否使用?
3、还有其它方法可使Delphi调用ACAD吗?
procedure TForm1.Button1Click(Sender: TObject);
var
obj_Acad :OleVariant;
begin
try
obj_Acad:=GetActiveOleObject('AutoCAD.Application.15');
except
obj_Acad:=CreateOleObject('AutoCAD.Application.15');
end;
obj_Acad.Visible:=True;
obj_ACAD.Documents.Open('g:\\AutoCad\data\dwg\4.dwg');
end;//for r14
procedure TForm1.Button1Click(Sender: TObject);
var
obj_Acad :OleVariant;
begin
try
obj_Acad:=GetActiveOleObject('AutoCAD.Application.14');
except
obj_Acad:=CreateOleObject('AutoCAD.Application.14');
end;
obj_Acad.Visible:=True;
obj_ACAD.ActiveDocument.Open('g:\\AutoCad\data\dwg\4.dwg');
end;