Hi
I have faced an issue I do not understand,
edit 4 of the post, added more tests ๐
edit 5, simplified first method even more.
This method,
[CommandMethod("testListConvertDxfDwgwithoutList", CommandFlags.Session)]
public static async void testListConvertDxfDwgwithoutList()
{
try
{
var promptResult = Application.DocumentManager.MdiActiveDocument.Editor.GetString("\nEnter the parameter: ");
if (promptResult.Status != PromptStatus.OK)
{
return;
}
var path = promptResult.StringResult;
DocumentCollection acDocMgr = Application.DocumentManager;
var doc = acDocMgr.Open(path, false);
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
await Application.DocumentManager.ExecuteInCommandContextAsync(
async (obj) => {
await ed.CommandAsync(new object[] { "testConvertDxfDwg" });
},
null);
} catch (Autodesk.AutoCAD.Runtime.Exception e)
{
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(e.ToString());
}
}
testConvertDxfDwg
public class testDxfDwg {
[CommandMethod("testConvertDxfDwg")]
public void testConvertDxDwg()
{
var doc = Application.DocumentManager.MdiActiveDocument;
doc.Editor.Command("ERASE", "CROSS", "0,0", "500,500", "");
}
}
If I run test testListConvertDxfDwgwithoutList from a .scr file, like this:
secureload 0
netload "...."
testListConvertDxfDwg "path to dxf.file"
Only two object, that are in 0,0 will be erased. Nothing else.
If I open the dxf manually, run this .scr file
secureload 0
netload "..."
testConvertDxfDwg
Erase will work and all 300ish object in the 0,0 - 500,500 area will be erased
Edit 4.
I changed the Erase command call to this,
doc.Editor.Command("_.ERASE", "CROSS", "-10,-10", "-5,-5", "");
When running it through the testListConvert... call, it still selects and erases the two objects that are in 0,0 but if I run it manually, it erases nothing (the expected behavior) How ?
So what am I missing? ๐
Solved! Go to Solution.
Solved by h3nrik. Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.