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

.Net Equivalent

2 REPLIES 2
Reply
Message 1 of 3
BrentBurgess1980
284 Views, 2 Replies

.Net Equivalent

Have been trying to find some information on getting points to draw temporary lines. So far I have

StartPoint = myDWG.Editor.GetPoint("Select Start Point:").Value
EndPoint = myDWG.Editor.GetPoint("Select End Point:").Value

which works great. What I would like to do is something similar to VBA - ie EndPoint = ThisDrawing.Utilities.GetPoint(StartPoint,"Select End Point: ") Is this possible? Secondly, as they are temporary lines, how do you go about deleting them? I have a VB.NET for AutoCAD book, but can't seem to find anything obvious that would do this.

Any help/suggestions appreciated.

Brent
2 REPLIES 2
Message 2 of 3

You need to call the other overload of GetPoint, which uses an argument of PromptPointOptions. You set the BasePoint property of the PromptPointOptions to your startpoint and set UseBasePoint to True. This will give you the rubber band line like your VBA function below. When you do it that way, Autocad takes care of refreshing the screen.

If you still need temporary graphics to show the segments already picked, you can do editor.DrawVector, and then a call to editor.Regen clears them. But I had some issues... If the user transparently pans the screen, any temporary graphics you had will go away, even if they should still be in the viewing area. I'm not sure, but you might be able to respond to an event and redraw your vectors to deal with that.
It also only draws the graphics in the current viewport.

Dave O.                                                                  Sig-Logos32.png
Message 3 of 3
Anonymous
in reply to: BrentBurgess1980

The PromptPointOptions class can be used to drag from a basepoint.

See the BasePoint and UseBasePoint properties of that class in
the docs.

Your example code suggests you need to become more familiar
with some more basic things, though. For example, you read the
'.Value' property of the object returned by GetPoint(), assuming
there was a valid response to the GetPoint() call, which may not
be the case.

In VBA, an exception is thrown when the user does not respond
to the input as expected (e..g, they press ESCape). In .NET, there
is no exception thrown, and you're required to check the Status
property of the PromptResult based class returned by most of the
GetXxxxx() methods.

So, you can't use the Value property of the PromptPointResult
returned by GetPoint, without first checking the Status property,
like this:

{code}

public static void Test()
{
PromptPointOptions ppo = new PromptPointOptions("\nFirst point: ");

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

PromptPointResult result = ed.GetPoint( ppo );

if( result.Status == PromptStatus.Ok )
{
// user responded with valid input, so get the second point:

Point3d startPoint = result.Value;
ppo.Message = "\nSecond point: ";

// Set basepoint to the first point entered:

ppo.BasePoint = startPoint;
ppo.UseBasePoint = true;

result = ed.GetPoint( ppo );

if( result.Status == PromptStatus.Ok )
{
ed.WriteMessage("\nFirst point: {0}", startPoint);
ed.WriteMessage("\nSecond point: {0}", result.Value);

// Both points were entered successfully, so use them

}
}
}

{code}

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:6054304@discussion.autodesk.com...
Have been trying to find some information on getting points to draw temporary lines. So far I have StartPoint = myDWG.Editor.GetPoint("Select Start Point:").Value EndPoint = myDWG.Editor.GetPoint("Select End Point:").Value which works great. What I would like to do is something similar to VBA - ie EndPoint = ThisDrawing.Utilities.GetPoint(StartPoint,"Select End Point: ") Is this possible? Secondly, as they are temporary lines, how do you go about deleting them? I have a VB.NET for AutoCAD book, but can't seem to find anything obvious that would do this. Any help/suggestions appreciated. Brent

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