.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lines to Closed Polylines to Spline

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
dynamicscope
727 Views, 5 Replies

Lines to Closed Polylines to Spline

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,

5 REPLIES 5
Message 2 of 6
Hallex
in reply to: dynamicscope

Try to search for CommandLine.cs written by Tony Tanzillo

 

~'J'~

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 6
dynamicscope
in reply to: Hallex

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)

Message 4 of 6
Hallex
in reply to: dynamicscope

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'~

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 5 of 6
dynamicscope
in reply to: Hallex

Ah ha~!!

 

select -> p

 

does the trick I need~!! 😃

 

You are always awesome.

Thank you very much.

 

Sincerely,

 

Jake

Message 6 of 6
Hallex
in reply to: dynamicscope

You're welcome, Jake

Thanks to Tony Tanzillo Smiley Happy

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost