Inserting Blocks Using Delphi - Tony?

Inserting Blocks Using Delphi - Tony?

Anonymous
Not applicable
166 Views
2 Replies
Message 1 of 3

Inserting Blocks Using Delphi - Tony?

Anonymous
Not applicable
Hi,

I've used Delphi extensively (thanks to Tony T.) and up to this point have
not had the need to insert a block. I'm using AutoCAD r14.01. I don' t
want to insert a drawing file since I like my applications to be self
sufficient when possible. I'm actually checking the block table to see if
it exists, if not the block is created. Up to this point everything works
great. I've checked to see that the block definition was created and was
able to insert the block using the insert command.

Where I run into problems is when I call the InsertBlock() method. I don't
get an error but the block is not inserted and there is a message displayed
everytime the method is called "Invalid Complex Object" or something to that
effect.

I don't have the code with me but after having creating a successful block
definition I call the following:

var
pt1 : OleVariant;
0 Likes
167 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hugo,

Do you really want to insert your block in another one
(nested block). In this case you won't see it immediately
unless the BlockEnt is referenced to *ModelSpace or
*PaperSpace. Naturally you cannot insert a block in
its own definition. I haven't checked this but it may result
in an "Invalid Complex Block".

If you just need to insert your block in ModelSpace try to
replace your BlockEnt with the ModelSpace object.

Denis

Hugo Guerrero a écrit dans le message
<82ak09$8p92@adesknews2.autodesk.com>...
>Hi,
>
>I've used Delphi extensively (thanks to Tony T.) and up to this point have
>not had the need to insert a block. I'm using AutoCAD r14.01. I don' t
>want to insert a drawing file since I like my applications to be self
>sufficient when possible. I'm actually checking the block table to see if
>it exists, if not the block is created. Up to this point everything works
>great. I've checked to see that the block definition was created and was
>able to insert the block using the insert command.
>
>Where I run into problems is when I call the InsertBlock() method. I don't
>get an error but the block is not inserted and there is a message displayed
>everytime the method is called "Invalid Complex Object" or something to
that
>effect.
>
>I don't have the code with me but after having creating a successful block
>definition I call the following:
>
>var
>pt1 : OleVariant;
>begin
>pt1 := AcPoint(1,1,0);
>BlockRef := BlockEnt.InsertBlock(pt1,'PT',1,1,0);
>end;
>
>Any help is appreciated.
>
>Hugo
>
>
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hugo - I can't guess what's going on in your code.

If you can post it, I'll have a look.

Hugo Guerrero wrote:
>
> Hi,
>
> I've used Delphi extensively (thanks to Tony T.) and up to this point have
> not had the need to insert a block. I'm using AutoCAD r14.01. I don' t
> want to insert a drawing file since I like my applications to be self
> sufficient when possible. I'm actually checking the block table to see if
> it exists, if not the block is created. Up to this point everything works
> great. I've checked to see that the block definition was created and was
> able to insert the block using the insert command.
>
> Where I run into problems is when I call the InsertBlock() method. I don't
> get an error but the block is not inserted and there is a message displayed
> everytime the method is called "Invalid Complex Object" or something to that
> effect.
>
> I don't have the code with me but after having creating a successful block
> definition I call the following:
>
> var
> pt1 : OleVariant;
> begin
> pt1 := AcPoint(1,1,0);
> BlockRef := BlockEnt.InsertBlock(pt1,'PT',1,1,0);
> end;
>
> Any help is appreciated.
>
> Hugo

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes