<?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: trouble in inserting block from another drawing in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987371#M13450</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;and regarding the block insertion, I do know that Kean's program will add block definitions not block references. but the problem is, &lt;EM&gt;&lt;FONT color="#FF0000"&gt;surprisingly my program isnt adding the block definitions at all&lt;/FONT&gt;&lt;/EM&gt;. even though when I ran Kean's programs without the form, it does work properly. I cant figure out where is my mistake.&lt;/P&gt;
&lt;P&gt;I attached my program, just in case if you or Gilles had some free time to take a quick look at it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does the source drawing contains any BLOCK definitions in it? Or the source drawing is just a block drawing file (thus no block definition in it)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2022 21:03:54 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2022-03-06T21:03:54Z</dc:date>
    <item>
      <title>trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10986638#M13447</link>
      <description>&lt;P&gt;Hi every one&lt;/P&gt;&lt;P&gt;Im having trouble inserting a block from another dwg file.&lt;/P&gt;&lt;P&gt;I have a form which contains a checked listbox which when ever the user single clicks on a block name from the checked list box, the program reads a preview image of that clicked block from a specific file location. my first question: is it possible to some how attach the images on the file itself so there would be no need to read images from an external file? if so, can any one tell me how to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my second question is, I was searching through Kean's website which I found an application where he inserts a block from another drawing into the current one, which the code is down below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;


namespace valve_blocks
{
    public class Util
    {
        [CommandMethod("NSVVALVES")]
        public void valves()
        {
            valve frm_valves = new valve();
            frm_valves.Show();   
        }

        public static void importBlock(string blkname)
        {
            DocumentCollection dm = Application.DocumentManager;
            Editor ed = dm.MdiActiveDocument.Editor;
            Database destDb = dm.MdiActiveDocument.Database;
            Database sourceDb = new Database(false, true);

            dm.MdiActiveDocument.LockDocument();


            try
            {
                // Get name of DWG from which to copy blocks
                //sourceFileName =ed.GetString("D:\C# codes\Block Insertion\legend-rev01.dwg");
                string address = "C:/NSV/Block Icons/Blocks.dwg";
                // Read the DWG into a side database
                sourceDb.ReadDwgFile(address, System.IO.FileShare.Read, true, "");

                // Create a variable to store the list of block identifiers
                ObjectIdCollection blockIds = new ObjectIdCollection();
                Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = sourceDb.TransactionManager;
                using (Transaction myT = tm.StartTransaction())
                {
                    // Open the block table
                    BlockTable bt = (BlockTable)tm.GetObject(sourceDb.BlockTableId, OpenMode.ForRead, false);

                    // Check each block in the block table
                    foreach (ObjectId btrId in bt)
                    {
                        BlockTableRecord btr = (BlockTableRecord)tm.GetObject(btrId, OpenMode.ForRead, false);

                        // Only add named &amp;amp; non-layout blocks to the copy list
                        if (!btr.IsAnonymous &amp;amp;&amp;amp; !btr.IsLayout &amp;amp;&amp;amp; btr.Name=="blkname") blockIds.Add(btrId);
                        btr.Dispose();
                    }
                }

                // Copy blocks from source to destination database
                IdMapping mapping = new IdMapping();
                sourceDb.WblockCloneObjects(blockIds, destDb.BlockTableId, mapping, DuplicateRecordCloning.Replace, false);

                //ed.WriteMessage("\nCopied " + blockIds.Count.ToString() + " block definitions from " + sourceFileName.StringResult + " to the current drawing.");
            }

            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                ed.WriteMessage("\nError during copy: " + ex.Message);
            }
            sourceDb.Dispose();
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that part works fine by itself, but when I call this method from a button which passes the checked items from the checked list box, it wont insert the blocks in the drawing. it doesnt even throw an error or exception. does it have to do some thing with the documentlock? which part am i doing worng?&lt;/P&gt;&lt;P&gt;this is my form 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;using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace valve_blocks
{
    public partial class valve : Form
    {
        public valve()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void valve_Load(object sender, EventArgs e)
        {
            lst_valves.Items.Add("Backflow Preventer-double check type");
            lst_valves.Items.Add("Backflow Preventer-reduced pressure zone");
            lst_valves.Items.Add("butterfly");
            lst_valves.Items.Add("Cap");
            lst_valves.Items.Add("Check Valv");
            
            
        }

        private void lst_valves_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void lst_valves_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                switch(lst_valves.SelectedItem)
                {
                    case ("Backflow Preventer-double check type"):
                        PicBox.Image=Image.FromFile("C:/NSV/Block icons/Backflow Preventer-double check type.bmp");
                        break;
                    case ("Backflow Preventer-reduced pressure zone"):
                        PicBox.Image=Image.FromFile("C:/NSV/Block icons/Backflow Preventer-reduced pressure zone.bmp");
                        break;
                    case ("butterfly"):
                        PicBox.Image=Image.FromFile("C:/NSV/Block icons/butterfly.bmp");
                        break;
                    case ("Cap"):
                        PicBox.Image=Image.FromFile("C:/NSV/Block icons/Cap.bmp");
                        break;
                    case ("Check Valv"):
                        PicBox.Image=Image.FromFile("C:/NSV/Block icons/Check Valv.bmp");
                        break;
                    
                }
            }
            catch (Exception ex)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("NSV ERROR: "+ ex.Message);
            }
        }
//button event which does not work
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            foreach (string blkname in lst_valves.CheckedItems)
            {
                Util.importBlock(blkname);
            }
            return;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is how the form looks:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_0-1646549883415.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1032897iBDAD6C939168BE6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1646549883415.png" alt="akouchakzadeh_0-1646549883415.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 06:59:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10986638#M13447</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2022-03-06T06:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987078#M13448</link>
      <description>&lt;P&gt;When you say "...&lt;SPAN&gt;is it possible to some how attach the images on &lt;FONT color="#FF0000"&gt;the file itself&lt;/FONT&gt; so...", what file are you refer to? Regardless of you have a bunch of preview pictures corresponding to block names available on disk, or you have to retrieve them from the drawing file, you could load them as an image collection (list, dictionary...) at once before your UI shows up, assume there are not too many of them, say hundreds or more.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BTW, your code in the "lst_valves_MouseClick" event handler really should be in "lst_vavles_SelectedIndexChanged" event handler.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As for your second question, if you have read Kean's article carefully and understood the difference between BlockTableRecord and BlockReference correctly,&amp;nbsp; the code in the method importBlock() is meant for bring block definitions (BlockTableRecords) from other drawing into current drawing. It does not insert blocks (BlockReferences!).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you run your command "NSVVALVES" against a blank drawing, after the command is done, you should be able to verify that the current drawing now has some block definitions available, that is a bunch of block definitions have been added the current drawing from a source drawing (not a block drawing, obviously).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 15:34:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987078#M13448</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-03-06T15:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987132#M13449</link>
      <description>&lt;P&gt;Mr. Yuan&lt;/P&gt;&lt;P&gt;Hello sir.&amp;nbsp;&lt;/P&gt;&lt;P&gt;since im a beginner on C#.net, can you please give me a hint how to create an image collection and how to set it to the picture box control?&lt;/P&gt;&lt;P&gt;does it has to do anything with adding resources?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regarding the mouse event, the reason why I have chosen the mouse event instead of index change is I wanned to get a preview of the block just by a single click instead of a double click.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and regarding the block insertion, I do know that Kean's program will add block definitions not block references. but the problem is, surprisingly my program isnt adding the block definitions at all. even though when I ran Kean's programs without the form, it does work properly. I cant figure out where is my mistake.&lt;/P&gt;&lt;P&gt;I attached my program, just in case if you or Gilles had some free time to take a quick look at it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 16:22:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987132#M13449</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2022-03-06T16:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987371#M13450</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;and regarding the block insertion, I do know that Kean's program will add block definitions not block references. but the problem is, &lt;EM&gt;&lt;FONT color="#FF0000"&gt;surprisingly my program isnt adding the block definitions at all&lt;/FONT&gt;&lt;/EM&gt;. even though when I ran Kean's programs without the form, it does work properly. I cant figure out where is my mistake.&lt;/P&gt;
&lt;P&gt;I attached my program, just in case if you or Gilles had some free time to take a quick look at it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does the source drawing contains any BLOCK definitions in it? Or the source drawing is just a block drawing file (thus no block definition in it)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2022 21:03:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987371#M13450</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-03-06T21:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987613#M13451</link>
      <description>&lt;P&gt;Also, look at this line of your code:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-csharp"&gt;&lt;CODE&gt;if (!btr.IsAnonymous &amp;amp;&amp;amp; !btr.IsLayout &amp;amp;&amp;amp; btr.Name=="blkname") blockIds.Add(btrId);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It would ONLY import a block definition names as "blkname", which I bet the source drawing does not have such a block definition in it, thus no actual&amp;nbsp; block definition is imported.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you did step-through in debugging, you would have found that the ObjectIdCollection (blockIds) is empty before the code calls WblockCloneObjects().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 01:56:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987613#M13451</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-03-07T01:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987810#M13452</link>
      <description>&lt;P&gt;thanks Mr. Yuan,&lt;/P&gt;&lt;P&gt;I cant believe I'm making such silly mistakes in my codes, its suppose to be blknames, not "blknames".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 05:27:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10987810#M13452</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2022-03-07T05:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10988579#M13453</link>
      <description>&lt;P&gt;mr. Yuan, can you give me a little hint on how to create an image collection and assign it to the picture box?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 13:26:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10988579#M13453</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2022-03-07T13:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10989293#M13454</link>
      <description>&lt;P&gt;When I mention a collection of picture (block preview image), I meant to preload these pictures into memory once, instead of load/reload the pictures again and again each time when user clicks a ListBox Item. So, the steps for your case would something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Import block definitions from a source drawing into your current drawing (MdiActiveDocument).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Obtain a block name list&lt;/P&gt;
&lt;P&gt;3. find/obtain block preview image for each block in the current drawing (either you have them already as saved *.bmp file, or you can extract them from the block definitions themselves dynamically, see my block article here:&amp;nbsp;&lt;A href="https://drive-cad-with-code.blogspot.com/2020/12/obtaining-blocks-image.html" target="_blank" rel="noopener"&gt;https://drive-cad-with-code.blogspot.com/2020/12/obtaining-blocks-image.html&lt;/A&gt;&amp;nbsp;), and save then in a collection, say a Dictionary with block name as key.&lt;/P&gt;
&lt;P&gt;4. Pass the block name list and the image dictionary to the form (say, as properties).&lt;/P&gt;
&lt;P&gt;5. Now when the form shows and user clicks ListBoxItem, you can handle the ListBox.SelectedIndexChnaged:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the form's code behind, you do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;private List&amp;lt;string&amp;gt; _blockNames=null;&lt;/P&gt;
&lt;P&gt;public List&amp;lt;string&amp;gt; BlockNames&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;_blockNames=value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;PopulateListBox(); // fill the listbox with the block name list here&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Get { return _blockNames;}&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;public Dictionary&amp;lt;string, Image&amp;gt; ImageDictionary{set; get;}=null;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, when you show the form in your CommandMethod:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//Here you import block definitions, after import, get a block name list&lt;/P&gt;
&lt;P&gt;var blockNames=ImportBlockDefinitions(sourceFile) ;&lt;/P&gt;
&lt;P&gt;// Then you obtain a image collection here&lt;/P&gt;
&lt;P&gt;var imgDict=GetBlockImages(blockNames);&lt;/P&gt;
&lt;P&gt;// Then you are ready to show the UI&lt;/P&gt;
&lt;P&gt;using (var form=new MyForm())&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;form.BlockNames=blockNames; //which also fill up the list box in the form&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;form.ImageDictionary=imgDict;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Application.ShowModalDialog(form); //DO NOT USE Form.Show()/ShowDialog()!!!&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;//handling ListBox.SelectedIndexChanged event to show picture of selected block definition&lt;/P&gt;
&lt;P&gt;private void ListBox_SelectedIndexChanged(....)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var blkName=listBox.Text;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;var img=ImageDictionary[blkName.ToUpper];&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;pictureControl.Picture=img;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for how the method GetBlockImages(), it should look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;private Dictionary&amp;lt;string, Image&amp;gt; GetBlockImages(List&amp;lt;string&amp;gt; blkNames)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp; var dict=new Dictionary&amp;lt;string, Image&amp;gt;();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; foreach (var blkName in blkNames)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; //You either load the picture from existing *.bmp file, or extract from block definition&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; // as the code shown in my article&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; var img=GetImageByBlockName(blkName);&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; if (img!=null) dict,Add(blkName.ToUpper(), img);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return dict;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope my provided enough hits for you to complete the code in detail&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, in vast majority of case, you would show the for as MODAL UI, not modeless UI. If you do need modeless UI for specific requirement, some more advanced code techniques are required to make it work properly (meaning a bit more study is required).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 18:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10989293#M13454</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-03-07T18:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: trouble in inserting block from another drawing</title>
      <link>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10989534#M13455</link>
      <description>&lt;P&gt;thank you sir.&lt;/P&gt;&lt;P&gt;that was awesome!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 20:21:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/trouble-in-inserting-block-from-another-drawing/m-p/10989534#M13455</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2022-03-07T20:21:46Z</dc:date>
    </item>
  </channel>
</rss>

