Message 1 of 13
How to open dwg one by one use delphi 5 and A2K?

Not applicable
01-31-2000
07:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm a new comer in delphi. I need open a lot of big dwg file
one by one.In my program I can open one dwg file but I can not
open them one by one. I get a error massage "the call be refused"
(Sorry. Because I used japanese version I can't give the exactly
error message). Is any one can help me or recommend some examples(VB or
delphi) .
By the way, how can I open some dwg files in same time with delphi and
A2K?
thank you!
This is my program.
function MyOpen(DWGFile: String): Boolean;
var
AcadObj: Variant;
acadDoc: Variant;
LayerColl, aLayer, ActLayerObj: Variant;
LayerName, ActiveLayerName : String;
begin
try
AcadObj := GetActiveOleObject('AutoCAD.Application');
except
try
AcadObj := CreateOleObject('AutoCAD.Application');
except
Exit;
end;
end;
AcadObj.Visible := True;
Acadobj.Documents.open(DWGFile);
acadDoc := AcadObj.ActiveDocument;
// acadDoc.Open(DWGFile);
LayerColl := acadDoc.Layers;
ActLayerObj := acadDoc.ActiveLayer;
ActiveLayerName := ActLayerObj.Name;
//to freeze every layer without '0'
for cnt := 0 to LayerColl.Count - 1 do
begin
aLayer := LayerColl.Item(cnt);
LayerName := aLayer.Name;
if ( ActiveLayerName <> '0') and ( LayerName = '0') then
acadDoc.ActiveLayer := aLayer;
if LayerName <> '0' then
aLayer.Freeze := True;
end;
// other process
end;
// for test
procedure TForm1.Button1Click(Sender: TObject);
begin
MyOpen('01.DWG');
MyOpen('02.DWG');
MyOpen('03.DWG');
end;
one by one.In my program I can open one dwg file but I can not
open them one by one. I get a error massage "the call be refused"
(Sorry. Because I used japanese version I can't give the exactly
error message). Is any one can help me or recommend some examples(VB or
delphi) .
By the way, how can I open some dwg files in same time with delphi and
A2K?
thank you!
This is my program.
function MyOpen(DWGFile: String): Boolean;
var
AcadObj: Variant;
acadDoc: Variant;
LayerColl, aLayer, ActLayerObj: Variant;
LayerName, ActiveLayerName : String;
begin
try
AcadObj := GetActiveOleObject('AutoCAD.Application');
except
try
AcadObj := CreateOleObject('AutoCAD.Application');
except
Exit;
end;
end;
AcadObj.Visible := True;
Acadobj.Documents.open(DWGFile);
acadDoc := AcadObj.ActiveDocument;
// acadDoc.Open(DWGFile);
LayerColl := acadDoc.Layers;
ActLayerObj := acadDoc.ActiveLayer;
ActiveLayerName := ActLayerObj.Name;
//to freeze every layer without '0'
for cnt := 0 to LayerColl.Count - 1 do
begin
aLayer := LayerColl.Item(cnt);
LayerName := aLayer.Name;
if ( ActiveLayerName <> '0') and ( LayerName = '0') then
acadDoc.ActiveLayer := aLayer;
if LayerName <> '0' then
aLayer.Freeze := True;
end;
// other process
end;
// for test
procedure TForm1.Button1Click(Sender: TObject);
begin
MyOpen('01.DWG');
MyOpen('02.DWG');
MyOpen('03.DWG');
end;