.NET

.NET

Reply
*Zhongwei Xia
Post 1 of 4

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

79 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
6 Posts
0 Kudos
Registered: ‎06-24-2005
Post 2 of 4

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
Post 3 of 4

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
4 Posts
0 Kudos
Registered: ‎12-07-2005
Post 4 of 4

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!