<?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: Need DXFIN command access (via acedCmd?) in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4894364#M45064</link>
    <description>&lt;P&gt;Hi Philips:&lt;/P&gt;&lt;P&gt;I tried your C# code, but nothing happened, could you tried&amp;nbsp;the attached&amp;nbsp;solution by your side?&lt;/P&gt;&lt;P&gt;If it is&amp;nbsp;stiil failed, could you change the code and let it run fine and save the entire solution and upload it?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;swaywood&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2014 02:35:49 GMT</pubDate>
    <dc:creator>swaywood</dc:creator>
    <dc:date>2014-03-19T02:35:49Z</dc:date>
    <item>
      <title>Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4884552#M45054</link>
      <description>&lt;P&gt;I need to be able to open a dxf using the dxfin command, via vb.net....Yes, for whatever reason, it really does have to be the dxfin command exactly like you'd use from the commend line. I can't open it any other way - not even in cad. These dxfs don't open at all unless you do it this way....so for now, you'll have to take my word for it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So - I need to be able to not only run the dxfin command, but pass the filename to it so it opens the dxf file. I've tried all sorts of things, and just spinning in circles here now. I think that I'd like to use acedCmd to do this, so that the rest of my code will wait until the command is done, but for the life of me, I can't get it to take the filename. Is there something special about this command that's not letting me pass the filename? Any other command that I test out using this method works just fine - but this one's not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions??&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2014 18:15:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4884552#M45054</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-13T18:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4889316#M45055</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Andrew,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can give a try at the two approaches illustrated below, one is with invoking DXFIN, the other with Database.DxfIn method.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[DllImport("accore.dll", CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Cdecl,
    EntryPoint = "acedCommandS")]
private static extern int acedCommandS(
    int type1,
    string str1,
    int type2,
    string str2,
    int end);

[CommandMethod("DxfInNet")]
public void DxfInNet()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;

    object filedia = Application.GetSystemVariable("FILEDIA");
    Application.SetSystemVariable("FILEDIA", 0);

    acedCommandS(5005, "_DXFIN", 5005, "c:\\Temp\\test.dxf", 5000);

    Application.SetSystemVariable("FILEDIA", filedia);
}

[CommandMethod("netInsertDxf")]
static public void netInsertDxf()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Database db = doc.Database;
    Editor ed = doc.Editor;

    Database TmpDb = new Database(false, true);
    TmpDb.DxfIn("C:\\Temp\\TempDb.dxf", "C:\\Temp\\TempDb.log");

    Matrix3d Transform = Matrix3d.Identity;
    db.Insert(Transform, TmpDb, true);
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;______________________________________________________________ &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0174DF"&gt;If my post answers your question, please click the &lt;STRONG&gt;"Accept as Solution"&lt;/STRONG&gt; &lt;BR /&gt;&lt;BR /&gt;button. This helps everyone find answers more quickly!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Mar 2014 20:31:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4889316#M45055</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-03-16T20:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890032#M45056</link>
      <description>&lt;P&gt;I'd tried the database.dxfin method before, and that doesn't work in my case with this dxf. Unfortunately, that method always results in crashing Autocad the second I import the database into the activedocument database...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your acedCommand method seems to get me a tiny bit further than I was able to get with acedCmd....I see the filename listed in the command prompt, but it's not doing anything. It's as though it's not ending the command....I see "_DXFIN File name: N:\drawings\45756660R.DXF", but it actually doesn't nothing.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2014 12:11:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890032#M45056</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-17T12:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890158#M45057</link>
      <description>&lt;P&gt;I don't see what would prevent you from using the solution with acedCommand I just provided, but here is the version with acedCmd, you probably omit the empty string at the end that sends command to the command line. In the future, you may want to show the code you are using, it helps understand what's going wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both versions work fine on my side:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[DllImport("accore.dll", 
    CharSet = CharSet.Ansi, 
    CallingConvention = CallingConvention.Cdecl, 
    EntryPoint = "acedCmd")]
private static extern int acedCmd(System.IntPtr vlist);

[CommandMethod("DxfInNet")]
public void DxfInNet()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;

    object filedia = Application.GetSystemVariable("FILEDIA");
    Application.SetSystemVariable("FILEDIA", 0);

    ResultBuffer rb = new ResultBuffer();

    rb.Add(new TypedValue(5005, "_DXFIN"));
    rb.Add(new TypedValue(5005, "c:\\Temp\\test.dxf"));        
    rb.Add(new TypedValue(5005, ""));

    acedCmd(rb.UnmanagedObject);

    Application.SetSystemVariable("FILEDIA", filedia);
}&lt;/PRE&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2014 13:17:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890158#M45057</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-03-17T13:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890244#M45058</link>
      <description>&lt;P&gt;Thanks - I didn't show any code because I was asking for example code, which is still the case. The only difference is that I'm using VB.net....but it's a pretty simple conversion in this case. Your acedCmd example is pretty much the same as the one I'd tried already....and I get the same result, which is nothing happening. I do see the command, but my dxf isn't open...It should be noted that my file name doesn't have the double slashes, but so far as I know, that's the way it should be with VB.net.....just for fun I tried it with the doubles and it didn't make any difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what my command line looks like after:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Command: Download_SNB _DXFIN File name: N:\drawings\45756660R.DXF&lt;BR /&gt;Command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2014 13:52:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890244#M45058</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-17T13:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890246#M45059</link>
      <description>Oh - and this is a plugin application...</description>
      <pubDate>Mon, 17 Mar 2014 13:52:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890246#M45059</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-17T13:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890282#M45060</link>
      <description>&lt;P&gt;Here is the VB.Net I used to test, no problem on my side. If this doesn't work for you, then I think it is beyond my competencies ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    &amp;lt;DllImport("accore.dll", &lt;BR /&gt;    CharSet:=CharSet.Unicode, &lt;BR /&gt;    CallingConvention:=CallingConvention.Cdecl, &lt;BR /&gt;    EntryPoint:="acedCmd")&amp;gt; _
    Private Shared Function acedCmd(ByVal vlist As IntPtr) As Integer

    End Function

    &amp;lt;CommandMethod("DXFINVB")&amp;gt; _
    Public Sub DXFINVB()

        Dim rb As ResultBuffer = New ResultBuffer()

        rb.Add(New TypedValue(5005, "_DXFIN"))
        rb.Add(New TypedValue(5005, "c:\Temp\test.dxf"))

        acedCmd(rb.UnmanagedObject)

    End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2014 14:14:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890282#M45060</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-03-17T14:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890358#M45061</link>
      <description>Looks like the problem is that these commands don't actually mimic the real DXFIN command in cad. I tried them with a different dxf (a more normal one) and it does work fine. But the clue that it's not behaving like the dxfin command normally does is that the document name is still just "Drawing1.dwg", and not the name of the dxf. If you open CAD and run dxfin, the document name is the name of the dxf. So it seems that these commands don't actually run dxfin in the same way....I was able to do this in VBA, but am trying to port things over to .net....so far, it's not going well.</description>
      <pubDate>Mon, 17 Mar 2014 14:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4890358#M45061</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-17T14:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4893234#M45062</link>
      <description>Guess I'm sticking with VBA then.</description>
      <pubDate>Tue, 18 Mar 2014 16:44:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4893234#M45062</guid>
      <dc:creator>andrew_demerchant</dc:creator>
      <dc:date>2014-03-18T16:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4893870#M45063</link>
      <description>&lt;P&gt;Usually invoking the commands with acedCommand / acedCmd has exactly the same effect than if you were typing them in the command line, but as you mehtioned DXFIN has a different behavior in that case. If you can get it done with VBA then stick with it. You can easily invoke the COM API from either a C# or VB.Net dll.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2014 21:24:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4893870#M45063</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-03-18T21:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4894364#M45064</link>
      <description>&lt;P&gt;Hi Philips:&lt;/P&gt;&lt;P&gt;I tried your C# code, but nothing happened, could you tried&amp;nbsp;the attached&amp;nbsp;solution by your side?&lt;/P&gt;&lt;P&gt;If it is&amp;nbsp;stiil failed, could you change the code and let it run fine and save the entire solution and upload it?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;swaywood&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 02:35:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4894364#M45064</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2014-03-19T02:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need DXFIN command access (via acedCmd?)</title>
      <link>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4894374#M45065</link>
      <description>I think the code maybe effected by 32 bit or 64 bit system.&lt;BR /&gt;My system is 64Bit.</description>
      <pubDate>Wed, 19 Mar 2014 02:49:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/need-dxfin-command-access-via-acedcmd/m-p/4894374#M45065</guid>
      <dc:creator>swaywood</dc:creator>
      <dc:date>2014-03-19T02:49:09Z</dc:date>
    </item>
  </channel>
</rss>

