.NET

Reply
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 1 of 6 (266 Views)
Accepted Solution

Lines to Closed Polylines to Spline

266 Views, 5 Replies
08-01-2012 02:43 AM

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,

*Expert Elite*
Hallex
Posts: 1,561
Registered: ‎10-08-2008
Message 2 of 6 (258 Views)

Re: Lines to Closed Polylines to Spline

08-01-2012 03:55 AM in reply to: dynamicscope

Try to search for CommandLine.cs written by Tony Tanzillo

 

~'J'~

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 3 of 6 (253 Views)

Re: Lines to Closed Polylines to Spline

08-01-2012 04:47 AM 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. :smileysad:

 

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)

*Expert Elite*
Hallex
Posts: 1,561
Registered: ‎10-08-2008
Message 4 of 6 (247 Views)

Re: Lines to Closed Polylines to Spline

08-01-2012 05:35 AM 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
Valued Contributor
dynamicscope
Posts: 95
Registered: ‎04-04-2012
Message 5 of 6 (227 Views)

Re: Lines to Closed Polylines to Spline

08-01-2012 10:49 PM in reply to: Hallex

Ah ha~!!

 

select -> p

 

does the trick I need~!! =)

 

You are always awesome.

Thank you very much.

 

Sincerely,

 

Jake

*Expert Elite*
Hallex
Posts: 1,561
Registered: ‎10-08-2008
Message 6 of 6 (214 Views)

Re: Lines to Closed Polylines to Spline

08-02-2012 05:17 AM in reply to: dynamicscope

You're welcome, Jake

Thanks to Tony Tanzillo :smileyhappy:

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community