- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I have this piece of code that works , values[0] and [1] are like 400,200 500,0 that are read from a text-file. So the script can go in and erase one time or eight times at different locations depending on data in text-file
ed = Application.DocumentManager.MdiActiveDocument.Editor;
ed.Command("ERASE, "CROSS", values[0].Trim(), values[1].Trim(), "");
Now I want to explode also, and thought I could just do
ed.Command("EXPLODE", "CROSS", values[0].Trim(), values[1].Trim(), "");
But it doesn't work at all, I get this output in the command window. But if I type out the commands manually it works fine..
Select object: 4000,2000
None found.
Select object: 0,0
Googling around all example I find is about exploading blocks with certain names or based on user selection, none which will work for me.
What am I doing wrong and what are my options?
Edit1:
Full method that I use to test, with static coordinates
[CommandMethod("valitExplodeTest")]
public static void ExplodeTest() {
var doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
try {
doc.Editor.ZoomExtents();
ed.Command("EXPLODE", "4000,2000","0,0", "");
} catch (Autodesk.AutoCAD.Runtime.Exception e) {
ed.WriteMessage(e.Message);
}
}
Edit2:
I tried to change the command to some variants, and tried just this
ed.Command("EXPLODE");
Which starts the EXPLODE command but I cannot select coordinates as I can if I type in EXPLODE myself, so comparing the arguments that EXPLODE is expecting:
Manual: Expects a point or Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon/Group/Add/Remove/Multiple/Previous/Undo/AUto/SIngle
From DLL: Expects a point or Last/ALL/Group
Both at least have point..and both have ALL. So I tried all
ed.Command("EXPLODE", "ALL","");
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
The object is not able to be exploded.
So it cannot explode anything...
Do I need to open some transaction or BlockTable or something before running explode? Ideas?
Solved! Go to Solution.