<?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 how new th file and open it. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-new-th-file-and-open-it/m-p/2184300#M75524</link>
    <description>How to new file in user input “new”,and opened this file.&lt;BR /&gt;
What event?or make there?&lt;BR /&gt;
&lt;BR /&gt;
This section of code below ,it can't Application.DocumentManager.Open. If opening will make a mistake.&lt;BR /&gt;
&lt;BR /&gt;
private void OnDocumentCreated( object sender, DocumentCollectionEventArgs e )&lt;BR /&gt;
{&lt;BR /&gt;
if (!e.Document.Name.ToUpper().Contains("\\"))&lt;BR /&gt;
{&lt;BR /&gt;
string DOCNO = ""; &lt;BR /&gt;
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);&lt;BR /&gt;
string secFildeName = ".dwg";&lt;BR /&gt;
string FilePath = "C:\\";&lt;BR /&gt;
if (DOCNO != "")&lt;BR /&gt;
{ &lt;BR /&gt;
Database db = new Database();&lt;BR /&gt;
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest); &lt;BR /&gt;
db.Dispose();&lt;BR /&gt;
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false); &lt;BR /&gt;
//Application.DocumentManager.MdiActiveDocument = doc;&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
This section of code below , it can Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);&lt;BR /&gt;
But “new” at new file,it’s not working.&lt;BR /&gt;
&lt;BR /&gt;
Document doc =  Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
doc.CommandEnded += new CommandEventHandler(cmdEnded);&lt;BR /&gt;
public void cmdEnded(object o, CommandEventArgs e)&lt;BR /&gt;
{&lt;BR /&gt;
if (e.GlobalCommandName.ToUpper().Contains("NEW"))&lt;BR /&gt;
{&lt;BR /&gt;
string DOCNO = ""; &lt;BR /&gt;
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);&lt;BR /&gt;
string secFildeName = ".dwg";&lt;BR /&gt;
string FilePath = "C:\\";&lt;BR /&gt;
if (DOCNO != "")&lt;BR /&gt;
{ &lt;BR /&gt;
Database db = new Database();&lt;BR /&gt;
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest); &lt;BR /&gt;
db.Dispose();&lt;BR /&gt;
&lt;BR /&gt;
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false); &lt;BR /&gt;
//Application.DocumentManager.MdiActiveDocument = doc;&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Best Regards</description>
    <pubDate>Wed, 20 Feb 2008 01:54:30 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-02-20T01:54:30Z</dc:date>
    <item>
      <title>how new th file and open it.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-new-th-file-and-open-it/m-p/2184300#M75524</link>
      <description>How to new file in user input “new”,and opened this file.&lt;BR /&gt;
What event?or make there?&lt;BR /&gt;
&lt;BR /&gt;
This section of code below ,it can't Application.DocumentManager.Open. If opening will make a mistake.&lt;BR /&gt;
&lt;BR /&gt;
private void OnDocumentCreated( object sender, DocumentCollectionEventArgs e )&lt;BR /&gt;
{&lt;BR /&gt;
if (!e.Document.Name.ToUpper().Contains("\\"))&lt;BR /&gt;
{&lt;BR /&gt;
string DOCNO = ""; &lt;BR /&gt;
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);&lt;BR /&gt;
string secFildeName = ".dwg";&lt;BR /&gt;
string FilePath = "C:\\";&lt;BR /&gt;
if (DOCNO != "")&lt;BR /&gt;
{ &lt;BR /&gt;
Database db = new Database();&lt;BR /&gt;
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest); &lt;BR /&gt;
db.Dispose();&lt;BR /&gt;
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false); &lt;BR /&gt;
//Application.DocumentManager.MdiActiveDocument = doc;&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
This section of code below , it can Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false);&lt;BR /&gt;
But “new” at new file,it’s not working.&lt;BR /&gt;
&lt;BR /&gt;
Document doc =  Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
doc.CommandEnded += new CommandEventHandler(cmdEnded);&lt;BR /&gt;
public void cmdEnded(object o, CommandEventArgs e)&lt;BR /&gt;
{&lt;BR /&gt;
if (e.GlobalCommandName.ToUpper().Contains("NEW"))&lt;BR /&gt;
{&lt;BR /&gt;
string DOCNO = ""; &lt;BR /&gt;
DOCNO = new VPGetNO().GetVPDMDocNo(Command.DBName, Command.loginID, Command.loginPwd);&lt;BR /&gt;
string secFildeName = ".dwg";&lt;BR /&gt;
string FilePath = "C:\\";&lt;BR /&gt;
if (DOCNO != "")&lt;BR /&gt;
{ &lt;BR /&gt;
Database db = new Database();&lt;BR /&gt;
db.SaveAs(FilePath + DOCNO, DwgVersion.Newest); &lt;BR /&gt;
db.Dispose();&lt;BR /&gt;
&lt;BR /&gt;
Document doc = Application.DocumentManager.Open(FilePath + DOCNO + secFildeName, false); &lt;BR /&gt;
//Application.DocumentManager.MdiActiveDocument = doc;&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Best Regards</description>
      <pubDate>Wed, 20 Feb 2008 01:54:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-new-th-file-and-open-it/m-p/2184300#M75524</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-20T01:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: how new th file and open it.</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-new-th-file-and-open-it/m-p/2184301#M75525</link>
      <description>use event DocumentCreated &lt;BR /&gt;
&lt;BR /&gt;
e.Document.Database.SaveAs(PahtFileName, DwgVersion.Newest);&lt;BR /&gt;
&lt;BR /&gt;
thks.&lt;BR /&gt;
question is solve.</description>
      <pubDate>Fri, 22 Feb 2008 19:00:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-new-th-file-and-open-it/m-p/2184301#M75525</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-02-22T19:00:01Z</dc:date>
    </item>
  </channel>
</rss>

