I am trying to do something complicated.
It will be similar to the following command sequence. (AutoCAD 2010)
pe (pedit)
m (multi select)
all (select all)
y (convert to polylines)
0 (set fuzzy 0)
j (join)
(done)
s (spline)
(done)
c (close)
(done)
(done)
But instead of "select all", I want to select the entities in the certain layer (this layer will only contain line entities)
I do not think SendStringToExcute() method can do such filtered selection in the middle of command sequence.
So I tried to look for a managed class method that does the "pedit" command. (No clue yet.)
So I am asking for your help.
Is there way to do such work (with C# ObjectARX 2010)?
It would be appreciated if someone can give me some code snippet.
Regards,
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Try to search for CommandLine.cs written by Tony Tanzillo
~'J'~
Thx for you reply.
It seems like Tony's CommandLine.cs is easy-to-use method for SendStringToExecute().
It still does not let me to do filtered selection (or quick selection) in the middle of my command sequence. 😞
Is there one line command for filtered selection or quick selection? (without the option dialogue. when I type "filter" or "qselect" a dialogue pops-up)
Here is a quick sample how to use CommandLine.cs to join:
[CommandMethod("JoinLayer","JL", CommandFlags.UsePickSet)] public static void Test() { Database db = HostApplicationServices.WorkingDatabase; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; string layer = ed.GetString("\nEnter layer name: ").StringResult; string ctab= Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("ctab").ToString(); using (Transaction tr = db.TransactionManager.StartTransaction()) { PromptSelectionOptions pso = new PromptSelectionOptions(); pso.MessageForRemoval = "\nNothing selected"; pso.MessageForAdding = "\nSelect lines and/or arcs only:"; TypedValue[] tvs = new TypedValue[] { new TypedValue(0, "line,arc"), new TypedValue(8, layer), new TypedValue(410, ctab) }; PromptSelectionResult pres = ed.SelectAll(new SelectionFilter(tvs)); if (pres.Status != PromptStatus.OK) return; SelectionSet ss = pres.Value; int res = CommandLine.Command ("._PEDIT", "_m", "_p", "", "_y", "_join", "", ""); ed.Regen(); tr.Commit(); } }
Change to your suit
~'J'~
Ah ha~!!
select -> p
does the trick I need~!! 😃
You are always awesome.
Thank you very much.
Sincerely,
Jake
You're welcome, Jake
Thanks to Tony Tanzillo
~'J'~