<?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 Get properties and place them into an attribute block in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12972982#M2855</link>
    <description>&lt;P&gt;Hello, I am attacking a very ambitious project right now. I want to create a C# (.NET) command that:&lt;BR /&gt;&lt;SPAN&gt;1. I want to insert an attribute block into a layout. The user should be able to choose a DWG file that the attribute lives in with the file explorer. Give the user the option to insert into the current layout or into every layout within a SSM &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. I want it to get all of the properties from the layout and the SSM it is part of. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. The name of each property (i.e. Totsheet) matches corresponds to a prompt in the attribute block. It should identify the prompt name and then insert the property gotten:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;I started by trying to achieve each goal individually (see below) and they work. They are slightly simpler versions, but I figured I could ramp them up when the time came. I used Audrey Bushman's code to access the SSM because I could not figure it out myself. I am using ChatGPT to help as well since I am not familiar with the API.&lt;BR /&gt;&lt;BR /&gt;My problems are:&lt;BR /&gt;1. I cant get the layout properties, only the SSM properties.&lt;BR /&gt;2. I can replace things within an attribute, but not the way I want to. The code that I've pieced together takes a string in from the user, then replaces all of the attributes with that string. I havent figured out any other attribute replacements that will work.&lt;BR /&gt;&lt;BR /&gt;if this is impossible i will be sad but not surprised.. thank you all in advance&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2024 19:27:50 GMT</pubDate>
    <dc:creator>hmsnake</dc:creator>
    <dc:date>2024-08-30T19:27:50Z</dc:date>
    <item>
      <title>Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12972982#M2855</link>
      <description>&lt;P&gt;Hello, I am attacking a very ambitious project right now. I want to create a C# (.NET) command that:&lt;BR /&gt;&lt;SPAN&gt;1. I want to insert an attribute block into a layout. The user should be able to choose a DWG file that the attribute lives in with the file explorer. Give the user the option to insert into the current layout or into every layout within a SSM &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. I want it to get all of the properties from the layout and the SSM it is part of. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. The name of each property (i.e. Totsheet) matches corresponds to a prompt in the attribute block. It should identify the prompt name and then insert the property gotten:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;I started by trying to achieve each goal individually (see below) and they work. They are slightly simpler versions, but I figured I could ramp them up when the time came. I used Audrey Bushman's code to access the SSM because I could not figure it out myself. I am using ChatGPT to help as well since I am not familiar with the API.&lt;BR /&gt;&lt;BR /&gt;My problems are:&lt;BR /&gt;1. I cant get the layout properties, only the SSM properties.&lt;BR /&gt;2. I can replace things within an attribute, but not the way I want to. The code that I've pieced together takes a string in from the user, then replaces all of the attributes with that string. I havent figured out any other attribute replacements that will work.&lt;BR /&gt;&lt;BR /&gt;if this is impossible i will be sad but not surprised.. thank you all in advance&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2024 19:27:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12972982#M2855</guid>
      <dc:creator>hmsnake</dc:creator>
      <dc:date>2024-08-30T19:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973003#M2856</link>
      <description>&lt;P&gt;Please &lt;A href="https://forums.autodesk.com/t5/vba/post-your-code/td-p/12324653/jump-to/first-unread-message" target="_blank" rel="noopener"&gt;post&amp;nbsp; your code&lt;/A&gt; to a code window.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 18:23:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973003#M2856</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-08-21T18:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973009#M2857</link>
      <description>&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System.Windows.Forms;

public class InsertExternalBlock
{
    [CommandMethod("InsertExtBlock")]
    public void InsertBlockFromExternalFile()
    {
        // Get the current document and editor
        Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
        Editor ed = doc.Editor;

        // Prompt user to select a DWG file to insert as a block
        OpenFileDialog openFileDialog = new OpenFileDialog
        {
            Filter = "DWG Files (*.dwg)|*.dwg",
            Title = "Select the DWG File to Insert as a Block"
        };

        if (openFileDialog.ShowDialog() != DialogResult.OK)
        {
            ed.WriteMessage("\nOperation cancelled.");
            return;
        }

        string dwgFilePath = openFileDialog.FileName;

        // Run the AutoCAD INSERT command to insert the DWG as a block
        ed.Command("_.-INSERT", dwgFilePath, "0,0,0", "1", "1", "0");
    }
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

[assembly: CommandClass(typeof(YourNamespace.UpdateBlockAttributesCommand))]

namespace YourNamespace
{
    public class UpdateBlockAttributesCommand : IExtensionApplication
    {
        public void Initialize() { }

        public void Terminate() { }

        [CommandMethod("UpdateBlockAttributes")]
        public void UpdateBlockAttributes()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            // Prompt user to enter the string
            PromptStringOptions promptStringOptions = new PromptStringOptions("\nEnter the string to insert into the block attributes: ");
            PromptResult promptResult = ed.GetString(promptStringOptions);

            if (promptResult.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\nOperation canceled.");
                return;
            }

            string userInput = promptResult.StringResult;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                // Iterate through all block references in the drawing
                BlockTable blockTable = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

                foreach (ObjectId blockId in blockTable)
                {
                    BlockTableRecord blockRecord = (BlockTableRecord)tr.GetObject(blockId, OpenMode.ForRead);

                    // Check if block name contains "Attrib"
                    if (blockRecord.Name.Contains("Attrib"))
                    {
                        // Iterate through all block references in the current space (ModelSpace or PaperSpace)
                        BlockTableRecord currentSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

                        foreach (ObjectId entityId in currentSpace)
                        {
                            Entity entity = (Entity)tr.GetObject(entityId, OpenMode.ForRead);

                            if (entity is BlockReference blockRef)
                            {
                                // Check if the block reference matches the desired block
                                if (blockRef.Name.Equals(blockRecord.Name, StringComparison.OrdinalIgnoreCase))
                                {
                                    foreach (ObjectId attId in blockRef.AttributeCollection)
                                    {
                                        AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForWrite);
                                        attRef.TextString = userInput;
                                    }
                                }
                            }
                        }
                    }
                }

                tr.Commit();
            }

            ed.WriteMessage("\nAttributes updated for blocks with 'Attrib' in their name.");
        }
    }
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using System.Text;
using System.Windows.Forms; // For MessageBox
using cad = Autodesk.AutoCAD.ApplicationServices.Application;
using App = Autodesk.AutoCAD.ApplicationServices;
using Db = Autodesk.AutoCAD.DatabaseServices;
using Ed = Autodesk.AutoCAD.EditorInput;
using Rtm = Autodesk.AutoCAD.Runtime;
using Comp = ACSMCOMPONENTS24Lib;
using Autodesk.Civil.DatabaseServices;

[assembly: Rtm.ExtensionApplication(typeof(Bushman.AutoCAD.SheetSetTools.SheetSetCommands))]
[assembly: Rtm.CommandClass(typeof(Bushman.AutoCAD.SheetSetTools.SheetSetCommands))]

namespace Bushman.AutoCAD.SheetSetTools
{
    public class SheetSetCommands : Rtm.IExtensionApplication
    {
        const string ns = "bush"; // namespace

        [Rtm.CommandMethod(ns, "ss-get-properties", Rtm.CommandFlags.Modal)]
        public void GetSheetSetProperties()
        {
            App.Document doc = cad.DocumentManager.MdiActiveDocument;
            Db.Database db = doc.Database;
            Ed.Editor ed = doc.Editor;
            Comp.AcSmSheetSetMgr mng = new Comp.AcSmSheetSetMgr();
            Comp.IAcSmEnumDatabase enumerator = mng.GetDatabaseEnumerator();
            enumerator.Reset();
            Comp.AcSmDatabase smDb = enumerator.Next();

            if (smDb != null)
            {
                try
                {
                    smDb.LockDb(db);
                    Comp.AcSmSheetSet sheetset = smDb.GetSheetSet();

                    if (sheetset != null)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.AppendLine($"Sheet Set Name: {sheetset.GetName()}");
                        sb.AppendLine($"Description: {sheetset.GetDesc()}");

                        // Retrieve custom properties
                        Comp.AcSmCustomPropertyBag customProperties = sheetset.GetCustomPropertyBag();
                        if (customProperties != null)
                        {
                            // List of desired custom property names
                            string[] desiredProperties = new string[]
                            {
                                "Project Name",
                                "Project Number",
                                "Issued Date:",
                                "Title1",
                                "Title2",
                                "Title3",
                                "TotSheets"
                            };

                            // Iterate through desired properties
                            foreach (var propertyName in desiredProperties)
                            {
                                try
                                {
                                    var property = customProperties.GetProperty(propertyName) as Comp.AcSmCustomPropertyValue;
                                    if (property != null)
                                    {
                                        sb.AppendLine($"{propertyName}: {property.GetValue()}");
                                    }
                                    else
                                    {
                                        sb.AppendLine($"{propertyName}: [Not Found]");
                                    }
                                }
                                catch (Exception ex)
                                {
                                    sb.AppendLine($"{propertyName}: Error retrieving value - {ex.Message}");
                                }
                            }
                        }
                        else
                        {
                            sb.AppendLine("No custom properties found.");
                        }

                        // Display the properties in a message box
                        MessageBox.Show(sb.ToString(), "Sheet Set Properties");
                    }
                    else
                    {
                        ed.WriteMessage("\nNo sheet set is available.");
                    }
                }
                catch (Exception ex)
                {
                    ed.WriteMessage($"\nError: {ex.Message}");
                }
                finally
                {
                    smDb.UnlockDb(db, true);
                }
            }
            else
            {
                ed.WriteMessage("\nNo sheet set is open.");
            }
        }

        private string GetCustomPropertyValue(Comp.AcSmCustomPropertyBag customProperties, string propertyName)
        {
            try
            {
                var property = customProperties.GetProperty(propertyName) as Comp.AcSmCustomPropertyValue;
                if (property != null)
                {
                    return property.GetValue();
                }
            }
            catch (Exception ex)
            {
                // Log or handle the exception if needed
                Console.WriteLine($"Error retrieving custom property {propertyName} - {ex.Message}");
            }
            return null;
        }

        public void Initialize()
        {
            App.Document doc = cad.DocumentManager.MdiActiveDocument;
            Ed.Editor ed = doc.Editor;
            ed.WriteMessage("\nSheetSetTools. © Andrey Bushman, 2013\n\n");
        }

        public void Terminate()
        {
            // Empty body.
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Aug 2024 18:26:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973009#M2857</guid>
      <dc:creator>hmsnake</dc:creator>
      <dc:date>2024-08-21T18:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973054#M2858</link>
      <description>&lt;P&gt;If I get more time, I might be able to add more, but here's an extension method that will help.&lt;/P&gt;
&lt;P&gt;BTW, I think it's Andrey, not Audrey.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;
        //InsertBlockReference
        /// &amp;lt;summary&amp;gt;
        /// Insert a block into the current space. You can optionally fill attribute values.
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="target"&amp;gt;The BlockTableRecord of the (model/paper) space to insert the block in.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="blkName"&amp;gt;A string of the block's name.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="insertPoint"&amp;gt;A Point3d to be used as the insertion point.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="attValues"&amp;gt;A Dictionary&amp;amp;gtstring, string&amp;amp;lt in the form of Key, value. 
        /// To be used to supply tag string values. If a key is not found for an attribute, 
        /// the value from the AttributeDefinition is used.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;see cref="Autodesk.AutoCAD.DatabaseServices.BlockReference"/&amp;gt; of the inserted block.&amp;lt;/returns&amp;gt;
        public static BlockReference InsertBlockReference(
                                        this BlockTableRecord target,
                                        string blkName,
                                        Point3d insertPoint,
                                        Dictionary&amp;lt;string, string&amp;gt; attValues = null)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            Database db = target.Database;
            Transaction tr = db.TransactionManager.TopTransaction ?? throw new AcRx.Exception(ErrorStatus.NoActiveTransactions);
            BlockReference br = null;
            BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);

            ObjectId btrId = bt.GetBlock(blkName);

            if (btrId != ObjectId.Null)
            {
                br = new BlockReference(insertPoint, btrId);
                _ = (BlockTableRecord)tr.GetObject(btrId, OpenMode.ForRead);
                target.AppendEntity(br);
                tr.AddNewlyCreatedDBObject(br, true);

                br.AddAttributeReferences(attValues);
            }
            return br;
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Aug 2024 18:45:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973054#M2858</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-08-21T18:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973191#M2859</link>
      <description>&lt;P&gt;Oh my gosh you are so right&lt;span class="lia-unicode-emoji" title=":hand_with_fingers_splayed:"&gt;🖐&lt;/span&gt; I will play around with this, thank you! If you have any information on accessing layout properties (within the same sheet set manage) that would be much appreciated as well!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 19:54:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973191#M2859</guid>
      <dc:creator>hmsnake</dc:creator>
      <dc:date>2024-08-21T19:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973199#M2860</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801"&gt;@Ed__Jobe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;If I get more time, I might be able to add more, but here's an extension method that will help.&lt;/P&gt;&lt;P&gt;BTW, I think it's Andrey, not Audrey.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;                br.AddAttributeReferences(attValues);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;That's not a method of BlockReference, so it must be an an extension method that comes from the same source as the rest of the code.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 20:00:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973199#M2860</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-08-21T20:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973374#M2861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14801"&gt;@Ed__Jobe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If I get more time, I might be able to add more, but here's an extension method that will help.&lt;/P&gt;
&lt;P&gt;BTW, I think it's Andrey, not Audrey.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;                br.AddAttributeReferences(attValues);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;That's not a method of BlockReference, so it must be an an extension method that comes from the same source as the rest of the code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;
        /// &amp;lt;summary&amp;gt;
        /// Extension method that returns adds &amp;lt;see cref="AttributeReference"/&amp;gt;'s to a &amp;lt;see cref="BlockReference"/&amp;gt;.
        /// AttributeReference values are taken from the Dictionary attValues argument.
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="target"&amp;gt;A BlockReference to add the AttributeReferences to.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="attValues"&amp;gt;The Dictionary to get attribute values from. 
        /// The first string is the Key and is equal to the AttributeDefinition.Tagstring.
        /// The second string is the attribute value.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;Void.&amp;lt;/returns&amp;gt;
        public static void AddAttributeReferences(this BlockReference target, Dictionary&amp;lt;string, string&amp;gt; attValues)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            Transaction tr = target.Database.TransactionManager.TopTransaction ?? throw new AcRx.Exception(ErrorStatus.NoActiveTransactions);
            BlockTableRecord btr = (BlockTableRecord)tr.GetObject(target.BlockTableRecord, OpenMode.ForRead);

            foreach (AttributeDefinition attDef in btr.AttributeDefinitions(tr))
            {
                if (!attDef.Constant)
                {
                    AttributeReference attRef = new AttributeReference();
                    attRef.SetAttributeFromBlock(attDef, target.BlockTransform);
                    if (attValues != null &amp;amp;&amp;amp; attValues.ContainsKey(attDef.Tag.ToUpper()))
                    {
                        attRef.TextString = attValues[attDef.Tag.ToUpper()];
                    }
                    target.AttributeCollection.AppendAttribute(attRef);
                    tr.AddNewlyCreatedDBObject(attRef, true);
                }
            }
        }


        /// &amp;lt;summary&amp;gt;
        /// Extension method that returns a &amp;lt;see cref="Collection"/&amp;gt; of &amp;lt;see cref="AttributeDefinition"/&amp;gt;'s from a &amp;lt;see cref="BlockTableRecord"/&amp;gt;.
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="btr"&amp;gt;This BlockTableRecord to use.&amp;lt;/param&amp;gt;
        /// &amp;lt;param name="trans"&amp;gt;The Transaction within which to pass the Collection of AttributeDefinitions.&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;A Collection of AttributeDefinitions.&amp;lt;/returns&amp;gt;
        public static Collection&amp;lt;AttributeDefinition&amp;gt; AttributeDefinitions(this BlockTableRecord btr, Transaction trans)
        {
            Collection&amp;lt;AttributeDefinition&amp;gt; atts = new Collection&amp;lt;AttributeDefinition&amp;gt;();

            RXClass theClass = RXObject.GetClass(typeof(AttributeDefinition));

            // Loop through the entities in model space
            foreach (ObjectId objectId in btr.Cast&amp;lt;ObjectId&amp;gt;())
            {
                // Look for entities of the correct type
                if (objectId.ObjectClass.IsDerivedFrom(theClass))
                {
                    AttributeDefinition attd = objectId.OpenAs&amp;lt;AttributeDefinition&amp;gt;(trans);
                    atts.Add(attd);
                }
            }
            return atts;
        }
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 14:51:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973374#M2861</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-08-22T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973687#M2862</link>
      <description>&lt;P&gt;The reason I put code on GitHub is because of this very problem - I can't afford to take the time to find and add all of the code which the code I'm sharing is dependent on, and in some cases, the dependencies can be half-a-dozen layers deep.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't write code that can exist in a vacuum (the way coding examples are written), because that's totally unacceptable for real-world application development . So, sharing snippets of code or individual methods is very difficult, as very little of the code I've written over the years can exist or work in a vacuum, without any dependence on other custom-developed code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;btr.AttributeDefinitions(tr)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're sharing your code, you can post it in a GitHub repository along with all of the code it's dependent on, and then just share a link to it, and you don't need to worry about finding out and adding what's missing.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 01:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12973687#M2862</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-08-22T01:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get properties and place them into an attribute block</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12975096#M2863</link>
      <description>&lt;P&gt;Yes, that's a good idea. I've only recently gotten access to GitHub here at work and I've been starting to do that.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 14:48:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-properties-and-place-them-into-an-attribute-block/m-p/12975096#M2863</guid>
      <dc:creator>Ed__Jobe</dc:creator>
      <dc:date>2024-08-22T14:48:46Z</dc:date>
    </item>
  </channel>
</rss>

