Author Topic: File New  (Read 3965 times)

0 Members and 1 Guest are viewing this topic.

DBARANAS

  • Guest
File New
« on: September 29, 2006, 05:53:22 AM »
I wonder if anyone has ever made a new .dwg file by just passing the file name directly without user interaction.

I can't find anything in *.Autodesk.AutoCAD.ApplicationServices and was hoping to find a .net way or maybe a DllImport

I keep project names in a datagridview and want to do all the file chores within my app and lock things up a bit.  :evil:


Glenn R

  • Guest
Re: File New
« Reply #1 on: September 29, 2006, 07:46:41 AM »
Do it all the time.

DBARANAS

  • Guest
Re: File New
« Reply #2 on: September 29, 2006, 10:55:17 AM »
Do it all the time.

I was thinking that this must be common

You can Open and Close a file like this so easy....but no .New

Code: [Select]
            ApplicationServices.Application.DocumentManager.CloseAll()
            ApplicationServices.Application.DocumentManager.Open("c:\test.dwg", False)


Chuck Gabriel

  • Guest
Re: File New
« Reply #3 on: September 29, 2006, 10:57:51 AM »
I think you want the Add method of the DocumentCollection object (which DocumentManager is an instance of).

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: File New
« Reply #4 on: September 29, 2006, 01:24:36 PM »
I wonder if anyone has ever made a new .dwg file by just passing the file name directly without user interaction.
What about:
Code: [Select]
Database db = new Database(true,false);
// Adding entities, etc.
//...
db.SaveAs(newDwgFileName,DwgVersion.Current);
Or I've not understand question?

DBARANAS

  • Guest
Re: File New
« Reply #5 on: September 29, 2006, 11:27:24 PM »
Thanks Chuck and Alexander!

Chuck

I tried the DocumentCollection way and it through an error about accessing a private method in that class.

Alexander

I tried this and it worked

        Dim db As Database = New Database(True, False)
        db.SaveAs("c:\test.dwg", DwgVersion.Current)

BTW...this is the reason I am doing things this way (attached bmp) so that everything made in the app gets created with a derived filename/path so i can span across projects and do reporting, etc. I can also load up projects with just ~3 mouse clicks and also get to anything just as fast.

I also think Windows Explorer was the stupidest thing ever invented, terribly inefficient kinda like Microsoft Bob(if anyone remembers that :lol:)

They should have paid Christian Ghilsler some money. Anyway I'm off on another Rant....Thanks again for helping me both of you







Glenn R

  • Guest
Re: File New
« Reply #6 on: September 30, 2006, 07:50:09 AM »
'File New' implies that you want a document in the EDITOR and Chuck was right on the money.
If, however, you want to create a new DATABASE, that a different story and Alex was on the money.

A document is associated with a database, but not necessarily so the other way.