Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[CommandMethod("WW", CommandFlags.UsePickSet | CommandFlags.Redraw)]
public void WW()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
doc.Editor.Command("._-OVERKILL", "_ALL", "", "");
string message, title, defaultValue;
string myValue;
message = "Enter The First Six Digits" + Environment.NewLine + "of the Work Order Number";
title = "Save W-Block";
defaultValue = "";
myValue = Interaction.InputBox(message, title, defaultValue);
if (myValue == "") return;
MyVar = myValue.Substring(0, 3);
MyResult = myValue;
MyFolder = @"W:\" + MyVar + "\\";
var prRes = ed.GetSelection();
if (prRes.Status != PromptStatus.OK)
return;
var objIds = new ObjectIdCollection();
var objIdArray = prRes.Value.GetObjectIds();
foreach (var id in objIdArray)
objIds.Add(id);
using (var newDb = new Database(true, false))
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
db.Wblock(newDb, objIds, new Point3d(0,0,0), DuplicateRecordCloning.Ignore);
FileName = MyFolder + MyResult;
FileName = FileName.Replace("(OK,", "");
FileName = FileName.Replace(")", "");
var mess = "Enter The Name to Save the File as";
var tle = "Save W-Block";
myValue = Interaction.InputBox(mess, tle, FileName);
if (myValue == "")
{
Application.Quit();
}
else if (myValue != "")
{
if (File.Exists(myValue + ".dwg"))
{
var dialogResult = MessageBox.Show("File Exists, Overwrite?", "Question",
MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
newDb.SaveAs(myValue + ".dwg", DwgVersion.AC1027);
else
return;
}
else
{
newDb.SaveAs(myValue + ".dwg", DwgVersion.AC1027);
}
}
}
}
;
MoreWs();
}This is the method I'm using, but the Wblock is never at the 0,0,0 location. Any help would be appreciated.
Solved! Go to Solution.