Highlight area inside polyline like the AREA command

Highlight area inside polyline like the AREA command

nshupeFMPE3
Advocate Advocate
1,405 Views
1 Reply
Message 1 of 2

Highlight area inside polyline like the AREA command

nshupeFMPE3
Advocate
Advocate

I'm trying to approach the problem from a few directions and I'm not sure which would be the best way. 

I want to use the AREA command that is built into AutoCAD to select lines and get the highlighted area inside, as well as the AREA commands nice REMOVE mode which removes area from the calculation as well. We use this work flow already in another context, but I'm trying to use this same work flow in our .NET plugin to get the area.

I know how to launch the command using 

            Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("._area add object", true, false, true);

 

What I dont know how to do would be retrieve the area from the command once it is through.

I'm also wanting to launch this command from a button on a ModalDialog. So I want to

Click a button

hide the dialog
Run the area command
return dialog when the area command is done
read the area that the area command calculated.

I'm not sure how to register that the AREA command is done running in order to unhide the dialog.


I could just recreate the AREA command using PromptEntityResult and KeywordResult, but then I wont get the nice highlighting of the AREA command....

Any help would be great!

0 Likes
1,406 Views
1 Reply
Reply (1)
Message 2 of 2

Norman_Yuan
Mentor
Mentor

IMO, it would be better to get needed area with your code that runs the same/similar to the "AREA" command, so that you have full control to guide how user picks and when data you want to return.

 

There are a few my old posts might be helpful:

https://drive-cad-with-code.blogspot.com/2011/01/mimicking-autocads-area-command-with.html 

https://drive-cad-with-code.blogspot.com/2011/01/mimicking-autocads-area-command-with_20.html 

https://drive-cad-with-code.blogspot.com/2011/01/mimicking-autocads-area-command-with_21.html 

 

Norman Yuan

Drive CAD With Code

EESignature