<?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: BlockReference SubEntities in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9716864#M23174</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;can you post your source code please,&lt;BR /&gt;i am trying to get the name of the Reference Block in the Model space but i couldn't achieve that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-08-28 11_07_58-Window.png" style="width: 341px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/812409iF729BC3201CF09C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="2020-08-28 11_07_58-Window.png" alt="2020-08-28 11_07_58-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2020 09:10:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-28T09:10:26Z</dc:date>
    <item>
      <title>BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8670497#M23171</link>
      <description>&lt;P&gt;I need to get the bounding box Min and Max points of a rectangle inside a BlockReference.&amp;nbsp; I have tried to get the sub entities thru the BlockRecord and then go thru the vertices of the rectangle (Polyline).&amp;nbsp; However, since this BlockReference is part of a title block in a drawing template, I would also have to deal with the drawing scale, the title block is in the model space.&amp;nbsp; See attached picture.&amp;nbsp; I just wandering if there is an easier way to achieve this. I will really appreciate any help.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NestedPolyLine.png" style="width: 458px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/615965i2E034DC2116F759C/image-size/large?v=v2&amp;amp;px=999" role="button" title="NestedPolyLine.png" alt="NestedPolyLine.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 03:56:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8670497#M23171</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2019-03-20T03:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8670659#M23172</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After getting the coordinates in the BlockTableRecord, you can transform them using the BlockReference.BlockTransform matrix.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 06:45:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8670659#M23172</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-03-20T06:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8674072#M23173</link>
      <description>&lt;P&gt;Gile, thank you very much for your help, it has been really appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 12:02:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/8674072#M23173</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2019-03-21T12:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9716864#M23174</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;can you post your source code please,&lt;BR /&gt;i am trying to get the name of the Reference Block in the Model space but i couldn't achieve that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-08-28 11_07_58-Window.png" style="width: 341px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/812409iF729BC3201CF09C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="2020-08-28 11_07_58-Window.png" alt="2020-08-28 11_07_58-Window.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 09:10:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9716864#M23174</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-28T09:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9719421#M23175</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;BR /&gt;You can get the block name using this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[CommandMethod("blockName")]
static public void blockName()

{
    Document doc = Application.DocumentManager.MdiActiveDocument;

    Database db = doc.Database;

    Editor ed = doc.Editor;

    PromptEntityOptions options =

             new PromptEntityOptions("\nSelect block reference");

    options.SetRejectMessage("\nSelect only block reference");

    options.AddAllowedClass(typeof(BlockReference), false);

    PromptEntityResult acSSPrompt = ed.GetEntity(options);

    using (Transaction tx =

                        db.TransactionManager.StartTransaction())

    {
        BlockReference blockRef = tx.GetObject(acSSPrompt.ObjectId,

                               OpenMode.ForRead) as BlockReference;

        BlockTableRecord block = null;

        if (blockRef.IsDynamicBlock)

        {

            //get the real dynamic block name.

            block = tx.GetObject(blockRef.DynamicBlockTableRecord,

                    OpenMode.ForRead) as BlockTableRecord;

        }

        else

        {
            block = tx.GetObject(blockRef.BlockTableRecord,

                        OpenMode.ForRead) as BlockTableRecord;
        }

        if (block != null)

        {

            ed.WriteMessage("Block name is : "

                                        + block.Name + "\n");

        }

        tx.Commit();

    }

}&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 30 Aug 2020 10:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9719421#M23175</guid>
      <dc:creator>marcin.sachs</dc:creator>
      <dc:date>2020-08-30T10:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: BlockReference SubEntities</title>
      <link>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9720705#M23176</link>
      <description>&lt;P&gt;Thanks for your &lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;Suggestion,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;I have to select the block reference, to get its name.&lt;BR /&gt;I got the list of the used blocks in the active dwg by this code. &lt;/SPAN&gt;&lt;/SPAN&gt;&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;[CommandMethod("REV1")]
        public void EditBlock1()
        {
            Document acDoc = Application.DocumentManager.MdiActiveDocument;


            Editor ed = acDoc.Editor;
            var acDb = HostApplicationServices.WorkingDatabase;

            using (var acTrans = acDb.TransactionManager.StartTransaction())
            {
                var acBlockTable =
                     acTrans.GetObject(acDb.BlockTableId, OpenMode.ForRead) as BlockTable;
                if (acBlockTable == null) return;

                var acBlockTableRecord = acTrans.GetObject(acBlockTable[BlockTableRecord.ModelSpace],
                                         OpenMode.ForRead) as BlockTableRecord;
                if (acBlockTableRecord == null) return;
                foreach (ObjectId id in acBlockTableRecord)
                {
                    string blockName;

                    BlockReference bref = acTrans.GetObject(id, OpenMode.ForRead) as BlockReference;

                    if (bref != null)

                    {
                        if (bref.IsDynamicBlock)
                        {
                            BlockTableRecord br = (BlockTableRecord)acTrans.GetObject(bref.DynamicBlockTableRecord, OpenMode.ForRead);
                            //blockName = br.Name;
                            blockName = "DynamicBlock";
                        }
                        else
                        {
                            blockName = bref.Name;
                        }
                        //Debug.WriteLine("Found block reference: " + blockName);
                        ed.WriteMessage("\n Found block reference:  {0}\n\n", blockName);
                    }
                }
                acTrans.Commit();
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 11:56:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/blockreference-subentities/m-p/9720705#M23176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-31T11:56:38Z</dc:date>
    </item>
  </channel>
</rss>

