<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to insert block with attributes into a drawing using .NET in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442887#M83667</link>
    <description>Most of the code from the example is not required if&lt;BR /&gt;
you make the change I noted. For example, there&lt;BR /&gt;
should be no need for manual translation, rotation,&lt;BR /&gt;
and scaling since the BlockTransform matrix contains&lt;BR /&gt;
all of that information, and SetAttributeFromBlock()&lt;BR /&gt;
should do the transformation for you.&lt;BR /&gt;
&lt;BR /&gt;
If I'm wrong about that, please let me know.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message news:4968152@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Guess what!? I just comment the following line out, and set TextStyle from &lt;BR /&gt;
AttributeDefinition. It works!!!.&lt;BR /&gt;
&lt;BR /&gt;
// attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
attRef.TextStyle = attDef.TextStyle;&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much. You emails help me alot.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4968102@discussion.autodesk.com...&lt;BR /&gt;
Amazing.&lt;BR /&gt;
&lt;BR /&gt;
The Matrix3d argument to SetAttributeFromBlock()&lt;BR /&gt;
should be set to the value of the BlockTransform&lt;BR /&gt;
property of the owning BlockReference object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4967872@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;</description>
    <pubDate>Tue, 27 Sep 2005 18:19:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-09-27T18:19:17Z</dc:date>
    <item>
      <title>How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442882#M83662</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by &lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing &lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime &lt;BR /&gt;
the attributes are inserted on Original position no matter how Position &lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia</description>
      <pubDate>Mon, 26 Sep 2005 21:51:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442882#M83662</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-26T21:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442883#M83663</link>
      <description>Does the sample code from ADN actually show a call &lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by &lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing &lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime &lt;BR /&gt;
the attributes are inserted on Original position no matter how Position &lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;</description>
      <pubDate>Tue, 27 Sep 2005 07:40:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442883#M83663</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-27T07:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442884#M83664</link>
      <description>Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Tue, 27 Sep 2005 13:44:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442884#M83664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-27T13:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442885#M83665</link>
      <description>Amazing.&lt;BR /&gt;
&lt;BR /&gt;
The Matrix3d argument to SetAttributeFromBlock()&lt;BR /&gt;
should be set to the value of the BlockTransform &lt;BR /&gt;
property of the owning BlockReference object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message news:4967872@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;</description>
      <pubDate>Tue, 27 Sep 2005 15:35:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442885#M83665</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-27T15:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442886#M83666</link>
      <description>Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Guess what!? I just comment the following line out, and set TextStyle from &lt;BR /&gt;
AttributeDefinition. It works!!!.&lt;BR /&gt;
&lt;BR /&gt;
// attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
attRef.TextStyle = attDef.TextStyle;&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much. You emails help me alot.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4968102@discussion.autodesk.com...&lt;BR /&gt;
Amazing.&lt;BR /&gt;
&lt;BR /&gt;
The Matrix3d argument to SetAttributeFromBlock()&lt;BR /&gt;
should be set to the value of the BlockTransform&lt;BR /&gt;
property of the owning BlockReference object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4967872@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Tue, 27 Sep 2005 15:55:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442886#M83666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-27T15:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442887#M83667</link>
      <description>Most of the code from the example is not required if&lt;BR /&gt;
you make the change I noted. For example, there&lt;BR /&gt;
should be no need for manual translation, rotation,&lt;BR /&gt;
and scaling since the BlockTransform matrix contains&lt;BR /&gt;
all of that information, and SetAttributeFromBlock()&lt;BR /&gt;
should do the transformation for you.&lt;BR /&gt;
&lt;BR /&gt;
If I'm wrong about that, please let me know.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message news:4968152@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Guess what!? I just comment the following line out, and set TextStyle from &lt;BR /&gt;
AttributeDefinition. It works!!!.&lt;BR /&gt;
&lt;BR /&gt;
// attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
attRef.TextStyle = attDef.TextStyle;&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much. You emails help me alot.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4968102@discussion.autodesk.com...&lt;BR /&gt;
Amazing.&lt;BR /&gt;
&lt;BR /&gt;
The Matrix3d argument to SetAttributeFromBlock()&lt;BR /&gt;
should be set to the value of the BlockTransform&lt;BR /&gt;
property of the owning BlockReference object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4967872@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;</description>
      <pubDate>Tue, 27 Sep 2005 18:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442887#M83667</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-27T18:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442888#M83668</link>
      <description>Thank you for your email.&lt;BR /&gt;
&lt;BR /&gt;
SetAttributeFromBlock() can't be called. If I call this function, attributes &lt;BR /&gt;
will go to (0,0,0) position.&lt;BR /&gt;
And also, if I set HorisontalMode of attribute, the attributes go to (0,0,0) &lt;BR /&gt;
again.&lt;BR /&gt;
attRef.HorizontalMode = &lt;BR /&gt;
Autodesk.AutoCAD.DatabaseServices.TextHorizontalMode.TextCenter;&lt;BR /&gt;
&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4968338@discussion.autodesk.com...&lt;BR /&gt;
Most of the code from the example is not required if&lt;BR /&gt;
you make the change I noted. For example, there&lt;BR /&gt;
should be no need for manual translation, rotation,&lt;BR /&gt;
and scaling since the BlockTransform matrix contains&lt;BR /&gt;
all of that information, and SetAttributeFromBlock()&lt;BR /&gt;
should do the transformation for you.&lt;BR /&gt;
&lt;BR /&gt;
If I'm wrong about that, please let me know.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4968152@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Guess what!? I just comment the following line out, and set TextStyle from&lt;BR /&gt;
AttributeDefinition. It works!!!.&lt;BR /&gt;
&lt;BR /&gt;
// attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
attRef.TextStyle = attDef.TextStyle;&lt;BR /&gt;
&lt;BR /&gt;
Thank you very much. You emails help me alot.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4968102@discussion.autodesk.com...&lt;BR /&gt;
Amazing.&lt;BR /&gt;
&lt;BR /&gt;
The Matrix3d argument to SetAttributeFromBlock()&lt;BR /&gt;
should be set to the value of the BlockTransform&lt;BR /&gt;
property of the owning BlockReference object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4967872@discussion.autodesk.com...&lt;BR /&gt;
Hi, Tony,&lt;BR /&gt;
&lt;BR /&gt;
Yes, it does. Thank you for your reply.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4967690@discussion.autodesk.com...&lt;BR /&gt;
Does the sample code from ADN actually show a call&lt;BR /&gt;
to SetAttributeFromBlock(), with Matrix3d.Identity as&lt;BR /&gt;
the second parameter???&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4967475@discussion.autodesk.com...&lt;BR /&gt;
Hello,&lt;BR /&gt;
&lt;BR /&gt;
Has everyone tried to insert blocks with attributes into a drawing file by&lt;BR /&gt;
using dotnet (C# or VB.NET)?&lt;BR /&gt;
&lt;BR /&gt;
There is an example "How to insert block with attributes into a drawing&lt;BR /&gt;
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime&lt;BR /&gt;
the attributes are inserted on Original position no matter how Position&lt;BR /&gt;
properties of the attributes are set.&lt;BR /&gt;
&lt;BR /&gt;
Following is part of my code:&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);&lt;BR /&gt;
&lt;BR /&gt;
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Y + attDef.Position.Y,&lt;BR /&gt;
&lt;BR /&gt;
blkRef.Position.Z + attDef.Position.Z);&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = ptBase;&lt;BR /&gt;
&lt;BR /&gt;
//attRef.Position = insPoint;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Position = new Point3d(50, 50, 50);&lt;BR /&gt;
&lt;BR /&gt;
attRef.Rotation = attDef.Rotation;&lt;BR /&gt;
&lt;BR /&gt;
attRef.Tag = attDef.Tag;&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = "Attribute Text";&lt;BR /&gt;
&lt;BR /&gt;
attRef.Height = attDef.Height;&lt;BR /&gt;
&lt;BR /&gt;
attRef.FieldLength = attDef.FieldLength;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can anybody help? Thank you very much.&lt;BR /&gt;
Zhongwei Xia&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Wed, 28 Sep 2005 15:30:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442888#M83668</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-28T15:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442889#M83669</link>
      <description>&amp;gt;&amp;gt; SetAttributeFromBlock() can't be called. &lt;BR /&gt;
&amp;gt;&amp;gt; If I call this function, attributes will go to (0,0,0) position.&lt;BR /&gt;
&lt;BR /&gt;
Did you pass the value of the BlockTransform property of &lt;BR /&gt;
the BlockReference object to the second argument to &lt;BR /&gt;
SetAttributesFromBlock, as I had mentioned earlier?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message news:4969406@discussion.autodesk.com...&lt;BR /&gt;
Thank you for your email.&lt;/ZXIA&gt;</description>
      <pubDate>Wed, 28 Sep 2005 17:45:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442889#M83669</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-28T17:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442890#M83670</link>
      <description>I just tried it. I works great.&lt;BR /&gt;
I appreciate your helps very much.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4969620@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt;&amp;gt; SetAttributeFromBlock() can't be called.&lt;BR /&gt;
&amp;gt;&amp;gt; If I call this function, attributes will go to (0,0,0) position.&lt;BR /&gt;
&lt;BR /&gt;
Did you pass the value of the BlockTransform property of&lt;BR /&gt;
the BlockReference object to the second argument to&lt;BR /&gt;
SetAttributesFromBlock, as I had mentioned earlier?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message &lt;BR /&gt;
news:4969406@discussion.autodesk.com...&lt;BR /&gt;
Thank you for your email.&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Wed, 28 Sep 2005 18:47:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442890#M83670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-28T18:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442891#M83671</link>
      <description>Is it possible for you to post the final code?&lt;BR /&gt;
Roland&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; schrieb im Newsbeitrag &lt;BR /&gt;
news:4969745@discussion.autodesk.com...&lt;BR /&gt;
I just tried it. I works great.&lt;BR /&gt;
I appreciate your helps very much.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4969620@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt;&amp;gt; SetAttributeFromBlock() can't be called.&lt;BR /&gt;
&amp;gt;&amp;gt; If I call this function, attributes will go to (0,0,0) position.&lt;BR /&gt;
&lt;BR /&gt;
Did you pass the value of the BlockTransform property of&lt;BR /&gt;
the BlockReference object to the second argument to&lt;BR /&gt;
SetAttributesFromBlock, as I had mentioned earlier?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4969406@discussion.autodesk.com...&lt;BR /&gt;
Thank you for your email.&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;</description>
      <pubDate>Fri, 30 Sep 2005 08:14:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442891#M83671</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-30T08:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442892#M83672</link>
      <description>Following is the code to insert AttributeReference.&lt;BR /&gt;
&lt;BR /&gt;
public static void InsertBlockAttibuteRef(ObjectId blockDefID, &lt;BR /&gt;
BlockReference blkRef,&lt;BR /&gt;
&lt;BR /&gt;
string strAttributeText, Point3d ptInsert)&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
&lt;BR /&gt;
Database dbCurrent = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
&lt;BR /&gt;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = &lt;BR /&gt;
dbCurrent.TransactionManager;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
using (Transaction tr = tm.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
&lt;BR /&gt;
DBObject objBlkRef = tr.GetObject(blkRef.ObjectId, OpenMode.ForWrite);&lt;BR /&gt;
&lt;BR /&gt;
BlockTableRecord btAttRec;&lt;BR /&gt;
&lt;BR /&gt;
btAttRec = (BlockTableRecord)tr.GetObject(blockDefID, OpenMode.ForRead);&lt;BR /&gt;
&lt;BR /&gt;
foreach (ObjectId idAtt in btAttRec)&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
&lt;BR /&gt;
Entity ent = (Entity)tr.GetObject(idAtt, OpenMode.ForRead);&lt;BR /&gt;
&lt;BR /&gt;
if (ent is AttributeDefinition)&lt;BR /&gt;
&lt;BR /&gt;
{&lt;BR /&gt;
&lt;BR /&gt;
AttributeDefinition attDef = (AttributeDefinition)ent;&lt;BR /&gt;
&lt;BR /&gt;
AttributeReference attRef = new AttributeReference();&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
attRef.SetAttributeFromBlock(attDef, blkRef.BlockTransform);&lt;BR /&gt;
&lt;BR /&gt;
attRef.TextString = strAttributeText;&lt;BR /&gt;
&lt;BR /&gt;
ObjectId idTemp = blkRef.AttributeCollection.AppendAttribute(attRef);&lt;BR /&gt;
&lt;BR /&gt;
tr.AddNewlyCreatedDBObject(attRef, true);&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
tr.Commit();&lt;BR /&gt;
&lt;BR /&gt;
} // end of using&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;ROLANDF&gt; wrote in message news:4971700@discussion.autodesk.com...&lt;BR /&gt;
Is it possible for you to post the final code?&lt;BR /&gt;
Roland&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; schrieb im Newsbeitrag&lt;BR /&gt;
news:4969745@discussion.autodesk.com...&lt;BR /&gt;
I just tried it. I works great.&lt;BR /&gt;
I appreciate your helps very much.&lt;BR /&gt;
Zhongwei&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message&lt;BR /&gt;
news:4969620@discussion.autodesk.com...&lt;BR /&gt;
&amp;gt;&amp;gt; SetAttributeFromBlock() can't be called.&lt;BR /&gt;
&amp;gt;&amp;gt; If I call this function, attributes will go to (0,0,0) position.&lt;BR /&gt;
&lt;BR /&gt;
Did you pass the value of the BlockTransform property of&lt;BR /&gt;
the BlockReference object to the second argument to&lt;BR /&gt;
SetAttributesFromBlock, as I had mentioned earlier?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Zhongwei Xia" &lt;ZXIA&gt; wrote in message&lt;BR /&gt;
news:4969406@discussion.autodesk.com...&lt;BR /&gt;
Thank you for your email.&lt;/ZXIA&gt;&lt;/TONY.TANZILLO&gt;&lt;/ZXIA&gt;&lt;/ROLANDF&gt;</description>
      <pubDate>Fri, 30 Sep 2005 15:18:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442892#M83672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-09-30T15:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to insert block with attributes into a drawing using .NET</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442893#M83673</link>
      <description>Thank you!&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Roland Feletic</description>
      <pubDate>Mon, 03 Oct 2005 09:38:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-insert-block-with-attributes-into-a-drawing-using-net/m-p/1442893#M83673</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-10-03T09:38:35Z</dc:date>
    </item>
  </channel>
</rss>

