.NET

Reply
*Zhongwei Xia
Message 1 of 4 (75 Views)

How to user Iterator to check Attributes inside BlockDefinition in C#?

75 Views, 3 Replies
06-24-2005 09:40 AM
Hi,

I'm trying to insert a block with attributes into drawing file model spacel.
I can only see the block, and can't get the attributes inserted. I think I
need to loop check the block definition, find attribute definitions in it,
and insert these attributes.

Following is the code to do insert block:
Autodesk.AutoCAD.DatabaseServices.BlockReference blkRef = new
BlockReference(insPnt, blockID);



using (Transaction myT = tm.StartTransaction())

{

BlockTable bt =
(BlockTable)tm.GetObject(currentdb.BlockTableId,OpenMode.ForRead, false);

BlockTableRecord btr =
(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite,false);

btr.AppendEntity(blkRef);

tm.AddNewlyCreatedDBObject(blkRef, true);

myT.Commit();

}



Thank you for any helps.

Zhongwei Xia
Active Member
totu
Posts: 6
Registered: ‎06-24-2005
Message 2 of 4 (75 Views)

Re: How to user Iterator to check Attributes inside BlockDefinition in C#?

06-24-2005 08:27 PM in reply to: *Zhongwei Xia
My QQ is:29873620 ,join me and talk ,ok?
now try to develop with c# and 2006
*Zhongwei Xia
Message 3 of 4 (75 Views)

Re: How to user Iterator to check Attributes inside BlockDefinition in C#?

06-27-2005 02:46 PM in reply to: *Zhongwei Xia
I know how to do it now.

totu, thank you for your posting anyway.
Zhongwei Xia

"Zhongwei Xia" wrote in message
news:4884810@discussion.autodesk.com...
Hi,

I'm trying to insert a block with attributes into drawing file model spacel.
I can only see the block, and can't get the attributes inserted. I think I
need to loop check the block definition, find attribute definitions in it,
and insert these attributes.

Following is the code to do insert block:
Autodesk.AutoCAD.DatabaseServices.BlockReference blkRef = new
BlockReference(insPnt, blockID);



using (Transaction myT = tm.StartTransaction())

{

BlockTable bt =
(BlockTable)tm.GetObject(currentdb.BlockTableId,OpenMode.ForRead, false);

BlockTableRecord btr =
(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite,false);

btr.AppendEntity(blkRef);

tm.AddNewlyCreatedDBObject(blkRef, true);

myT.Commit();

}



Thank you for any helps.

Zhongwei Xia
Member
Kairat Galiyev
Posts: 4
Registered: ‎12-07-2005
Message 4 of 4 (75 Views)

Re: How to user Iterator to check Attributes inside BlockDefinition in C#?

01-16-2006 01:40 AM in reply to: *Zhongwei Xia
Hello!
I have same problem, but i don't know similar solution.
If it possible, please, send me mail, or publish your solution at the this forum.

my mail kairat.galiyev@gmail.com

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community