Full disclosure(and my first post!) I'm very new to programming.
I want to create my own File Dialog Box so that it behaves how most people in the office would like it to. It will be a separate command, but work almost identically. One feature I want set is that when the command is run, it opens the dialog box in the location of the current drawing the user is in(we have over 1000 different project folders on the network).
The other is just setting only .dwg to viewable to weed out the noise. (this part seems to work already).
So my issue right now is I'm not even sure how to approach getting the File Dialog box to launch an actual drawing. I can get it to pop up, but selecting and clicking OK(this is probably the method I need to use). I've been searching for a couple days and almost everything I've come across is hard-coding a drawing path into the code.
My attempts earlier were trying to do it via SendStringToExecute, but I don't think that's the proper way to approach this.
Regardless of the fact that I can't get that to work either. Any help would be greatly appreciated.
Here's my random/crap code(note I'm programming this to work in Autocad and Bricscad):
namespace HASD_QuickOpen
{
public class Commands : AcTrx.IExtensionApplication
{
public void Initialize()
{
}
public void Terminate()
{
}
[AcTrx.CommandMethod("QO", AcTrx.CommandFlags.Session)]
public void SelectFiles()
{
AcEd.Editor ed = AcAp.Application.DocumentManager.MdiActiveDocument.Editor;
AcAp.Document doc = AcAp.Application.DocumentManager.MdiActiveDocument;
AcDb.HostApplicationServices hs = AcDb.HostApplicationServices.Current;
AcWnd
.OpenFileDialog ofd
= new AcWnd
.OpenFileDialog("Select a file using an OpenFileDialog",
null,
"dwg;*",
"SelectFileTest", AcWnd
.OpenFileDialog.OpenFileDialogFlags.AllowMultiple); //I think I should be getting the current drawing path and setting it as the default here
System.Windows.Forms.DialogResult dr = ofd.ShowDialog();
string filePath = dr.ToString();
string fpStr = (filePath.ToString());
string cmdStr = @"_open" + fpStr;
doc.SendStringToExecute(cmdStr, true, true, true); //I can't get it to just take cmdStr
}
}
}
edit-kdub : formatting [code=csharp]