<?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: Issues adding an Attribute to an Entity in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452044#M55669</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Fatnastic!!!! That's exactly what i was looking for!!!! Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;SPAN&gt;&lt;SPAN class="hps"&gt;This is not fantasy&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;it is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;a minimal&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;knowledge of the &lt;/SPAN&gt;&lt;SPAN class="hps"&gt;AutoCAD &lt;SPAN&gt;&lt;SPAN class="hps"&gt;capabilities&lt;/SPAN&gt; &lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 May 2012 14:21:29 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2012-05-10T14:21:29Z</dc:date>
    <item>
      <title>Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451822#M55664</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to add an attribute to an entity, however it seems that the AttributeDefinition requires a Point3d and as such appear in my modelspace. I don't want this, i just wanted it to appear as an attribute with a value when i click on my entity, is there any way of making it so that i does not add into modelspace?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Vince&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; {
                    BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);

                    for (int i = 0; i &amp;lt; prSelectionResult.Value.Count; i++)
                    {
                        // Get the entity the user had selected
                        Entity ent = (Entity)trans.GetObject(prSelectionResult.Value[i].ObjectId, OpenMode.ForWrite);

                        if (ent.GetType() == typeof(BlockReference))
                        {
                            // Add attribute to layer
                            BlockReference blockRef = (BlockReference)ent;
                            AttributeDefinition attDef = new AttributeDefinition(new Point3d(0d, 0d, 0d), "World, I'm an attribute!", "Hello", "", db.Textstyle);
                            
                            // Add the attribute to to the BlockTrableRecord of the blockdefinition of the selected block
                            ObjectId btrId = blockRef.BlockTableRecord;
                            BlockTableRecord btrBlock = (BlockTableRecord)trans.GetObject(btrId, OpenMode.ForWrite);
                            btrBlock.AppendEntity(attDef);
                            trans.AddNewlyCreatedDBObject(attDef, true);

                            // Add the AttributeReference to the BlockReference                            
                             AttributeReference attRef = new AttributeReference();
                             attRef.SetAttributeFromBlock(attDef, blockRef.BlockTransform);
                             blockRef.AttributeCollection.AppendAttribute(attRef);
                             trans.AddNewlyCreatedDBObject(attRef, true);
                                          
                        }
                    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 12:46:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451822#M55664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-10T12:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451880#M55665</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;Maybe you can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;explain&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in detail&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;what does it do&lt;/SPAN&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="hps"&gt;It seems to me&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;that this is not&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the best practice&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;each time&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;to change the number&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;AttributeDefinition&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in the block.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 13:15:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451880#M55665</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-05-10T13:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451994#M55666</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was searching through other posts and examples in the forums and came across this. What it does is add an attribute to an entity, in this case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello: World, I'm an Attribute!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see in the attached photo however, the attribute is also placed into modelspace as per the lines:&lt;/P&gt;&lt;PRE&gt;BlockReference blockRef = (BlockReference)ent;
                            AttributeDefinition attDef = new AttributeDefinition(new Point3d(0d, 0d, 0d), "World, I'm an Attribute!", "Hello", "", db.Textstyle);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;What i'm trying to do is avoid having the attribute placed in my modelspace, just in the entity.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:04:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3451994#M55666</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-10T14:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452016#M55667</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="hps"&gt;Do I understand correctly&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;that&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;you do not want&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;to&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;attributes&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;were visible on&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the screen (model space)?&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN class="hps"&gt;Then it is sufficient&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;to set their&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;property&lt;/SPAN&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN class="hps"&gt;Invisible&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt; to &lt;EM&gt;&lt;STRONG&gt;true&lt;/STRONG&gt;&lt;/EM&gt; or property &lt;SPAN class="hps"&gt;&lt;EM&gt;&lt;STRONG&gt;Visible&lt;/STRONG&gt;&lt;/EM&gt; to&lt;/SPAN&gt; &lt;EM&gt;&lt;STRONG&gt;false&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Property &lt;EM&gt;&lt;STRONG&gt;Visible&lt;/STRONG&gt;&lt;/EM&gt; is common entity property, but &lt;EM&gt;&lt;STRONG&gt;Invisible&lt;/STRONG&gt;&lt;/EM&gt; is only AttributeReference (and AttributeDefinition) property.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;attdef.Invisible = true;&lt;BR /&gt;attref.Invisible = true;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:19:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452016#M55667</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-05-10T14:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452032#M55668</link>
      <description>&lt;P&gt;Fantastic!!!! That's exactly what i was looking for!!!! Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***Edited for spelling&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:42:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452032#M55668</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-10T14:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452044#M55669</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;Fatnastic!!!! That's exactly what i was looking for!!!! Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;SPAN&gt;&lt;SPAN class="hps"&gt;This is not fantasy&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;-&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;it is&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;a minimal&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;knowledge of the &lt;/SPAN&gt;&lt;SPAN class="hps"&gt;AutoCAD &lt;SPAN&gt;&lt;SPAN class="hps"&gt;capabilities&lt;/SPAN&gt; &lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452044#M55669</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-05-10T14:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452114#M55670</link>
      <description>&lt;P&gt;I've just begun working with attributes and am very new to the AutoCAD API in general so I was not aware of this property. Although it may seem like minimal knowledge to some, to me it's quite new and something I will definetly remember as I continue &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Vince&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:43:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452114#M55670</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-10T14:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452188#M55671</link>
      <description>&lt;P&gt;Would be good as well to add one line in your code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" face="arial,helvetica,sans-serif"&gt;&lt;FONT color="#2b91af"&gt;&lt;FONT color="#2b91af"&gt;&lt;FONT color="#2b91af"&gt;AttributeReference&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; attRef = &lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;new&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#2b91af"&gt;&lt;FONT color="#2b91af"&gt;&lt;FONT color="#2b91af"&gt;AttributeReference&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" face="arial,helvetica,sans-serif"&gt;﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attRef.SetAttributeFromBlock(attDef, blockRef.BlockTransform);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" face="arial,helvetica,sans-serif"&gt;﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1" face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blockRef.AttributeCollection.AppendAttribute(attRef);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#000000" size="1"&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; additional line:﻿&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;﻿&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;&lt;FONT color="#ff0000" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attRef.AdjustAlignment(db);&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trans.AddNewlyCreatedDBObject(attRef,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="1"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;&lt;FONT color="#0000ff"&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" size="1"&gt;~'J'~﻿&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 15:06:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452188#M55671</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-05-10T15:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issues adding an Attribute to an Entity</title>
      <link>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452198#M55672</link>
      <description>&lt;P&gt;Thanks Hallex, will do!&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 15:08:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issues-adding-an-attribute-to-an-entity/m-p/3452198#M55672</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-05-10T15:08:45Z</dc:date>
    </item>
  </channel>
</rss>

