.NET

Reply
Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 1 of 9 (480 Views)
Accepted Solution

How to end the Polyline command?

480 Views, 8 Replies
11-16-2010 06:29 AM

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.

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 2 of 9 (471 Views)

Re: How to end the Polyline command?

11-16-2010 06:45 AM 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.

Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 3 of 9 (429 Views)

Re: How to end the Polyline command?

11-17-2010 12:59 AM 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

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 4 of 9 (423 Views)

Re: How to end the Polyline command?

11-17-2010 01:58 AM 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 :smileyhappy:

Thanks for the link too :smileyhappy:

Valued Contributor
kob4lt
Posts: 61
Registered: ‎04-14-2010
Message 5 of 9 (406 Views)

Re: How to end the Polyline command?

11-17-2010 11:22 AM in reply to: ognyandim

So what this all have to do with .NET?

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 6 of 9 (398 Views)

Re: How to end the Polyline command?

11-18-2010 01:34 AM 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 :smileyhappy: Here is his class.

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



Valued Mentor
KerryBrown
Posts: 269
Registered: ‎11-29-2008
Message 7 of 9 (394 Views)

Re: How to end the Polyline command?

11-18-2010 01:47 AM 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. !!

//-------------------------------------------------------

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

Valued Contributor
ognyandim
Posts: 59
Registered: ‎05-21-2008
Message 8 of 9 (389 Views)

Re: How to end the Polyline command?

11-18-2010 02:54 AM 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.

Distinguished Contributor
Irvin
Posts: 112
Registered: ‎04-22-2009
Message 9 of 9 (375 Views)

Re: How to end the Polyline command?

11-18-2010 05:58 AM 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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.