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

How to end the Polyline command?

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
ognyandim
1089 Views, 8 Replies

How to end the Polyline command?

I am trying this with Tony`s CommandLine Class

 

 CommandLine.Command("_PLINE", "20.0,0.0", "30.0,30.0", "15.0,0.0", "7.0,7.0");

 

But after this line AutoCAD continues to prompt me for the next POINT.

 

This wont work too :

 CommandLine.Command("_PLINE", "20.0,0.0", "30.0,30.0", "15.0,0.0", "7.0,7.0", " "); <- blank space here

 

I dont know a command to cancel this because "space"  does not work.

 

Does anybody know a command to cancel the polyline command?

 

I am using autoCAD 2008 and 2007.

8 REPLIES 8
Message 2 of 9
ognyandim
in reply to: ognyandim

CommandLine.Command("_PLINE", "20.0,0.0", "30.0,30.0", "15.0,0.0", "7.0,7.0", " "); <- This will not work

 

CommandLine.Command("_PLINE", "20.0,0.0", "30.0,30.0", "15.0,0.0", "7.0,7.0", ""); <- This works and terminates the command. I suppose this will work with every other command.

 

Sorry for answering my own question, but when I got a problem I just cant continue before solving it.

Message 3 of 9
Irvin
in reply to: ognyandim

Can you tell me why you use a command string to draw a pline.

 

Pleaze look at this document link. It's from the AutoCAD.NET Developers Guide.

This sample demonstrates how te create a pline from points stored in a collection.

 

You can create a method wich passes a collection of points and a pline will be created for you.

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/files/WS1a9193826455f5ff2...

 

Kind regards,

 

Irvin

Message 4 of 9
ognyandim
in reply to: ognyandim

Yes, you are right. The reason is that I want to make some short cuts in my code. There are a lot of procedures that I rewrite whenever possible with the command line. I try different techniques. The first is only .NET and the other is command line with event handlers. Sometimes 4-5 lines for command line equals to 20-30 lines of .NET code. I just want to know both ways 🙂

Thanks for the link too 🙂

Message 5 of 9
kob4lt
in reply to: ognyandim

So what this all have to do with .NET?

Message 6 of 9
ognyandim
in reply to: ognyandim

Because the calss that I am using is a .NET class. That is Tonys clas. It is faster sometimes to make one line of a command() rather than sever lines with transaction and so forth with code. For example the XLINE in 2007 is coded different in 2008.

 

By using CommandLine I have the same command working for both versions without any change in the code.

// This works in 2008 will not even compile in 2007

// because of the following error :

// Error    1    'Autodesk.AutoCAD.DatabaseServices.Xline' does not contain a definition for 'SecondPoint'   

 

XLine hhline = new Xline();

hhline.SecondPoint = getPointResult2.Value;

 

I find it useful to create my graphical stuff with commandLine and collect the objectIds through an event handler and when I finish I just collect the Ids from a class ObjecIdCollection and do whatever is needed.

 

I am grateful to Tony Tanzillo 🙂 Here is his class.

http://www.caddzone.com/CommandLine.cs



Message 7 of 9
kdub_nz
in reply to: ognyandim

My suggestion :

As soon as possible stop using Command from net.

Thats like having a lamborghini and using a goat to pull it around. !!


// Called Kerry in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Message 8 of 9
ognyandim
in reply to: ognyandim

If you tell me the way to create polylines, then join them, then extrude them to solid in 6 lines of .NET code I will be convinced. I use this as a shortcut. I dont say that it is perfect. It is a way to write things fast at first place.

Message 9 of 9
Irvin
in reply to: ognyandim

I can't create it in 6 lines of code. But i can create a function or a method which you can provide with a collection of points. Create an in memory polyline. Make an extrusion from that in memory pline and add the extruded element to the drawing.

 

Yes this function or method consist of more lines of code but its one function so when you need to change it it's in one place.

 

And writing your six lines of code over and over again for each of your elements will be more lines of code.

 

Look at this link

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/files/WS1a9193826455f5ff2...

 

In this sample the create 2 in memory circle and then turn them to a region.

 

And if you combine some functions in from this sample:

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/files/WS1a9193826455f5ff2...

 

you only need to create something to supply the function with your coordinates to create your in memory plines.

 

Kind regards,

 

Irvin

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