<?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 can I  insert rasterImage  but not depend on the ori file outside? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927629#M49505</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; If you can give me some code [...]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code to do what? Running the command &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;_ETRANSMIT&lt;/FONT&gt; or embedding an ole-object into the drawing?&lt;/P&gt;&lt;P&gt;The command _ETRANSMIT is ready to use, there has nothing to be added, it exists &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;OLE-embedding (which I would avoid as long as possible) ... have you searched here? There are already some threads: &lt;A target="_self" href="https://forums.autodesk.com/t5/forums/searchpage/tab/message?filter=labels%2Clocation&amp;amp;location=forum-board%3A152&amp;amp;q=ole"&gt;&amp;gt;&amp;gt;&amp;gt;click&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
    <pubDate>Sat, 18 May 2013 13:17:54 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2013-05-18T13:17:54Z</dc:date>
    <item>
      <title>How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927358#M49501</link>
      <description>&lt;P&gt;How can I&amp;nbsp; bind the rasterImage as part of dwg file not depend on the ori file outside?&lt;/P&gt;&lt;P&gt;I use the&amp;nbsp;imageattach order,&amp;nbsp;However&amp;nbsp; when i delete the ori image or send the dwg file to others&lt;/P&gt;&lt;P&gt;the image is&amp;nbsp;wrong.&amp;nbsp;&amp;nbsp;How can i solve it ? Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2013 08:54:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927358#M49501</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-18T08:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927360#M49502</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; However&amp;nbsp; when i delete the ori image or send the dwg file to othersthe image is&amp;nbsp;wrong.&amp;nbsp;&amp;nbsp;How can i solve it ?&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Use command&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt; _ETRANSMIT &lt;/FONT&gt;(&lt;A target="_self" href="http://docs.autodesk.com/ACD/2011/ENU/filesAUG/WS1a9193826455f5ffa23ce210c4a30acaf-5792.htm#WSc30cd3d5faa8f6d81893efeffc2d678ba-7fdf"&gt;&amp;gt;&amp;gt;&amp;gt;details&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;) to transfer your project data, so refrences will not be missed then.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; How can I&amp;nbsp; bind the rasterImage as part of dwg file&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;You might insert it as OLE-object, but there are then some issues like file-size, some problems when printing (might be) and some more (read here in the forum about problems with OLE objects, for me: enough to avoid it)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2013 09:09:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927360#M49502</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2013-05-18T09:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927600#M49504</link>
      <description>&lt;P&gt;Thanks for your reply! If you can give me some code for example ,that will be perfect!&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2013 11:43:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927600#M49504</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-18T11:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927629#M49505</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; If you can give me some code [...]&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Code to do what? Running the command &lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;_ETRANSMIT&lt;/FONT&gt; or embedding an ole-object into the drawing?&lt;/P&gt;&lt;P&gt;The command _ETRANSMIT is ready to use, there has nothing to be added, it exists &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;OLE-embedding (which I would avoid as long as possible) ... have you searched here? There are already some threads: &lt;A target="_self" href="https://forums.autodesk.com/t5/forums/searchpage/tab/message?filter=labels%2Clocation&amp;amp;location=forum-board%3A152&amp;amp;q=ole"&gt;&amp;gt;&amp;gt;&amp;gt;click&amp;lt;&amp;lt;&amp;lt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2013 13:17:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927629#M49505</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2013-05-18T13:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927844#M49506</link>
      <description>&lt;P&gt;Thanks,I will try it ,Then give&amp;nbsp; you a feedback&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2013 08:52:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927844#M49506</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-19T08:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927915#M49507</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I read this code&lt;/P&gt;&lt;P&gt;[CommandMethod("InsertOle")]&lt;/P&gt;&lt;P&gt;public static void InsertOle()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Document doc = Application.DocumentManager.MdiActiveDocument;&lt;/P&gt;&lt;P&gt;Database db = doc.Database;&lt;/P&gt;&lt;P&gt;Editor ed = doc.Editor;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Database refDb = new Database();&lt;/P&gt;&lt;P&gt;refDb.ReadDwgFile("c:\\Temp\\MyOleTemplate.dwg", System.IO.FileShare.Read, true, "");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (Transaction Tx = db.TransactionManager.StartTransaction())&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;BlockTable bT = Tx.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;&lt;/P&gt;&lt;P&gt;BlockTableRecord bTR = Tx.GetObject(bT[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ObjectId btrId = db.Insert("MyOleTemplate", refDb, true);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BlockReference blockRef = new BlockReference(new Point3d(), btrId);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DBObjectCollection entitySet = new DBObjectCollection();&lt;/P&gt;&lt;P&gt;blockRef.Explode(entitySet);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;foreach (object obj in entitySet)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;if (obj is Ole2Frame)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ole2Frame ole = obj as Ole2Frame;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bTR.AppendEntity(ole);&lt;/P&gt;&lt;P&gt;Tx.AddNewlyCreatedDBObject(ole, true);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tx.Commit();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;However I have two question about it.&lt;/P&gt;&lt;P&gt;1、Should MyOleTemplate.dwg be a special file that with the image I want to insert?&lt;/P&gt;&lt;P&gt;2、&lt;/P&gt;&lt;P&gt;if (obj is Ole2Frame)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ole2Frame ole = obj as Ole2Frame;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bTR.AppendEntity(ole);&lt;/P&gt;&lt;P&gt;Tx.AddNewlyCreatedDBObject(ole, true);&lt;/P&gt;&lt;P&gt;can i use this code set &amp;nbsp; 'ole ' to another image&amp;nbsp;file&amp;nbsp; and &amp;nbsp;then the image&amp;nbsp;file&amp;nbsp;it will independ outside？&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2013 12:02:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3927915#M49507</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-05-19T12:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I  insert rasterImage  but not depend on the ori file outside?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3935123#M49508</link>
      <description>&lt;P&gt;How about using "WblockCloneObjects" to get the Ole2Frame from the other drawing ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code that you can try :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Document doc = Application.DocumentManager.MdiActiveDocument;
Database destDb = doc.Database;
Editor ed = doc.Editor;

PromptResult prTableStyleName = ed.GetString("\nEnter drawing file path : ");
if (prTableStyleName.Status != PromptStatus.OK)
    return;
string dwgFilePath = prTableStyleName.StringResult;

if (!System.IO.File.Exists(dwgFilePath))
    return;

using (Database srcDb = new Database(false, true))
{
    srcDb.ReadDwgFile(dwgFilePath, System.IO.FileShare.Read, true, "");

    ObjectIdCollection oleObjectIds = new ObjectIdCollection();
    using (Transaction Tx = srcDb.TransactionManager.StartTransaction())
    {
        BlockTable bT = Tx.GetObject(srcDb.BlockTableId, OpenMode.ForWrite) as BlockTable;
        BlockTableRecord btr = Tx.GetObject(bT[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
        foreach (ObjectId id in btr)
        {
            if (id.ObjectClass.Name != "AcDbOle2Frame")
                continue;
            oleObjectIds.Add(id);
            break;
        }
        Tx.Commit();
    }

    if (oleObjectIds.Count &amp;gt; 0)
    {
        ObjectId destBTRId = destDb.CurrentSpaceId;
        IdMapping iMap = new IdMapping();
        destDb.WblockCloneObjects(oleObjectIds, destBTRId, iMap, DuplicateRecordCloning.Replace, false);

        IdPair idPair = iMap.Lookup(oleObjectIds[0]);
        ObjectId newId = idPair.Value;
        if (newId.IsValid)
        {
            PromptPointResult pr = ed.GetPoint("\nSelect insertion point: ");
            if (pr.Status == PromptStatus.OK)
            {
                Point3d pt = pr.Value;
                using (Transaction Tx = destDb.TransactionManager.StartTransaction())
                {
                    Ole2Frame ole2Frame = Tx.GetObject(newId, OpenMode.ForWrite) as Ole2Frame;
                    dynamic acadOle = ole2Frame.AcadObject;

                    double[] insertionPoint = new double[3];
                    insertionPoint[0] = pt.X;
                    insertionPoint[1] = pt.Y;
                    insertionPoint[2] = pt.Z;

                    acadOle.InsertionPoint = insertionPoint;

                    Tx.Commit();
                }
            }
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2013 12:32:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-can-i-insert-rasterimage-but-not-depend-on-the-ori-file/m-p/3935123#M49508</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-05-24T12:32:46Z</dc:date>
    </item>
  </channel>
</rss>

