AutoCAD 2004/2002 and AcadBlockReference

AutoCAD 2004/2002 and AcadBlockReference

Anonymous
Not applicable
189 Views
0 Replies
Message 1 of 1

AutoCAD 2004/2002 and AcadBlockReference

Anonymous
Not applicable
I have created 2 TLBs one for AutoCAD2002 another for 2004, and change Delphi code to support both versions, everything works fine except when i'm using AcadBlockReference, I have something like this:

function foo()
var
...
blockRefObj,
currDwg :IDispatch;
varAttributes : OleVariant;
begin
....
if AutoCAD2004 then
begin
blockRefObj := (currDwg as INAcadDocument).ModelSpace.InsertBlock(varInsPoint, sblkName,sXScale,sXScale,sXScale,0.0, EmptyParam);
end else//The block exists so just update the attributes
blockRefObj := varSelSet.Item(0);
varAttributes := (blockrefObj as INAcadBlockReference).GetAttributes;
end else
begin
blockRefObj := (currDwg as IOAcadDocument).ModelSpace.InsertBlock(varInsPoint, sblkName,sXScale,sXScale,sXScale,0.0);
end else//The block exists so just update the attributes
blockRefObj := varSelSet.Item(0);
varAttributes := (blockrefObj as IOAcadBlockReference).GetAttributes;
end;
//then try this
for indx := 0 to cdsAcad.RecordCount -1 do
begin
varAttributes[ictr].textString := cdsAcadt.FieldByName('n1').text;
varAttributes[ictr+1].textString := cdsAcadt.FieldByName('n2').text;
varAttributes[ictr+2].textString := cdsAcadt.FieldByName('n3').text;
cdsAcadCompliment.Next;
iCtr := iCtr +3;
....
end;

It works fine with AutoCAD2002 but get error when using 2004 "Library not register: in line
varAttributes[ictr].textString := cdsAcadt.FieldByName('n1').text;
I did try some type casting as INAcadAttributeDisp but wouldn't compile
anybody experiencing something similar

thanks in advance!
0 Likes
190 Views
0 Replies
Replies (0)