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

loop while getpoint succeeds

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
3533 Views, 14 Replies

loop while getpoint succeeds

How to loop until user quits picking points (escapes)
this works but don't know if there's a better way

Dim bGotPoint As Boolean

bGotPoint = True

Do While bGotPoint = True

Try

ptInsert = m_acadDoc.Utility.GetPoint(, "Pick Insertion Point(s) or escape
to cancel:")

Catch ex As Exception

bGotPoint = False

Exit Do

End Try

DoSomething(ptInsert)

Loop
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

You might also try posting questions about using ActiveX in the VBA/ActiveX
newsgroup.

The discussion here focuses mainly on using the managed ObjectARX API with
any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
VBA, VB, and other languages, including VB.NET.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295554@discussion.autodesk.com...
How to loop until user quits picking points (escapes)
this works but don't know if there's a better way

Dim bGotPoint As Boolean

bGotPoint = True

Do While bGotPoint = True

Try

ptInsert = m_acadDoc.Utility.GetPoint(, "Pick Insertion Point(s) or escape
to cancel:")

Catch ex As Exception

bGotPoint = False

Exit Do

End Try

DoSomething(ptInsert)

Loop
Message 3 of 15
Anonymous
in reply to: Anonymous

in my (admittedly demented) mind, the question was on the general loop
structure, 🙂
not whether i was using
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint

versus
acadDoc.Utility.GetPoint
I will try to rewrite it in net api and repost
Thanks
mark


"Tony Tanzillo" wrote in message
news:6295570@discussion.autodesk.com...
You might also try posting questions about using ActiveX in the VBA/ActiveX
newsgroup.

The discussion here focuses mainly on using the managed ObjectARX API with
any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
VBA, VB, and other languages, including VB.NET.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295554@discussion.autodesk.com...
How to loop until user quits picking points (escapes)
this works but don't know if there's a better way

Dim bGotPoint As Boolean

bGotPoint = True

Do While bGotPoint = True

Try

ptInsert = m_acadDoc.Utility.GetPoint(, "Pick Insertion Point(s) or escape
to cancel:")

Catch ex As Exception

bGotPoint = False

Exit Do

End Try

DoSomething(ptInsert)

Loop
Message 4 of 15
norman.yuan
in reply to: Anonymous

Well, the result from user's action at the prompt of pick is handled quite differently in .NET API and in COM API, which may considerably make your code for the loop different enough.

In .NET API, you use PromptPointOptions in conjunction with PromptResult. after user's action (good pick, hit an unexpected key, Esc...), you use PromptStatus enum to make decision easily (to continue or abort).

While in COM loop, you have to handle error to catch Esc key press....

If you are doing .NET API inside Acad, there is no point to use AcadUtility.GetPoint().

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 15
Anonymous
in reply to: Anonymous

Hi Tony,

In your mania to impose your illogical rules on posters who are trying
to move to Net and supply some ActiveX code they've have previously used
to illustrate a point you've totally failed to assist them in any way.

Look at Norman's reply where he has actually wanted to help the OP move
to Net.


Regards,


Laurie Comerford


Tony Tanzillo wrote:
> You might also try posting questions about using ActiveX in the VBA/ActiveX
> newsgroup.
>
> The discussion here focuses mainly on using the managed ObjectARX API with
> any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
> VBA, VB, and other languages, including VB.NET.
>
>
Message 6 of 15
Anonymous
in reply to: Anonymous

right, the example was from a project i've been tasked to modify. it was
written in vbnet using com interop to the active x api as was pointed out.
I plan to rewrite(eventually) in c# net api after refactoring to modify
behaviour...since it's already in vbnet, it's easy enough to modify,
as i'm getting more familiar with the net api i will probably port it over
as i get time.
I'd seen the PromptPointOptions object and will go looking for a quick
example of it's use, shouldn't be too hard to compose a decent loop with
that
Thanks
mark

wrote in message news:6295676@discussion.autodesk.com...
Well, the result from user's action at the prompt of pick is handled quite
differently in .NET API and in COM API, which may considerably make your
code for the loop different enough.

In .NET API, you use PromptPointOptions in conjunction with PromptResult.
after user's action (good pick, hit an unexpected key, Esc...), you use
PromptStatus enum to make decision easily (to continue or abort).

While in COM loop, you have to handle error to catch Esc key press....

If you are doing .NET API inside Acad, there is no point to use
AcadUtility.GetPoint().
Message 7 of 15
Anonymous
in reply to: Anonymous

Laurie - Thank you for reiterating and making even more clear, the fact that
you are incapable of distinguishing generic VB.NET programming language
subjects, from subjects relating to using the AutoCAD Managed API, as that
is all that your post in this thread has accomplished.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Laurie" wrote in message
news:6295718@discussion.autodesk.com...
Hi Tony,

In your mania to impose your illogical rules on posters who are trying
to move to Net and supply some ActiveX code they've have previously used
to illustrate a point you've totally failed to assist them in any way.

Look at Norman's reply where he has actually wanted to help the OP move
to Net.


Regards,


Laurie Comerford


Tony Tanzillo wrote:
> You might also try posting questions about using ActiveX in the
> VBA/ActiveX
> newsgroup.
>
> The discussion here focuses mainly on using the managed ObjectARX API with
> any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
> VBA, VB, and other languages, including VB.NET.
>
>
Message 8 of 15
Anonymous
in reply to: Anonymous

{quote}

the question was on the general loop structure, 🙂

{quote}

Not a problem, but if you're still becoming familiar with VB.NET and the
.NET framework, my advice is the same, just the destination would be the
relevant MSDN discussion group(s), rather than the VBA/ActiveX newsgroup
here.

That's where I go to post or read about general topics relating to using a
.NET language or the .NET framework, mainly because I get more/better/faster
answers to questions there.

The folks there are good at helping with questions like this, regardless of
the 'context' (e.g., managed AutoCAD .NET or AutoCAD ActiveX programming).

In any case, the file at this link shows an example of looping while the
user continues to pick points, using the managed API and C#:

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

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295638@discussion.autodesk.com...
in my (admittedly demented) mind, the question was on the general loop
structure, 🙂
not whether i was using
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint

versus
acadDoc.Utility.GetPoint
I will try to rewrite it in net api and repost
Thanks
mark


"Tony Tanzillo" wrote in message
news:6295570@discussion.autodesk.com...
You might also try posting questions about using ActiveX in the VBA/ActiveX
newsgroup.

The discussion here focuses mainly on using the managed ObjectARX API with
any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
VBA, VB, and other languages, including VB.NET.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295554@discussion.autodesk.com...
How to loop until user quits picking points (escapes)
this works but don't know if there's a better way

Dim bGotPoint As Boolean

bGotPoint = True

Do While bGotPoint = True

Try

ptInsert = m_acadDoc.Utility.GetPoint(, "Pick Insertion Point(s) or escape
to cancel:")

Catch ex As Exception

bGotPoint = False

Exit Do

End Try

DoSomething(ptInsert)

Loop
Message 9 of 15
NathTay
in reply to: Anonymous

Tony has by far successfully assisted more people here than any one else. What have you done?
Message 10 of 15
NathTay
in reply to: Anonymous

You still have not answered these simple questions

Can I post Visual Basic 2008 Code that uses the ActiveX API in the Visual Basic Customisation Group?
Can I post Visual Basic 2008 Code that uses the .NET API in the Visual Basic Customisation Group?

from this post

http://discussion.autodesk.com/forums/thread.jspa?threadID=740169&tstart=200
Message 11 of 15
Anonymous
in reply to: Anonymous

Awesome! Thanks Tony!

"Tony Tanzillo" wrote in message
news:6295754@discussion.autodesk.com...
{quote}

the question was on the general loop structure, 🙂

{quote}

Not a problem, but if you're still becoming familiar with VB.NET and the
.NET framework, my advice is the same, just the destination would be the
relevant MSDN discussion group(s), rather than the VBA/ActiveX newsgroup
here.

That's where I go to post or read about general topics relating to using a
.NET language or the .NET framework, mainly because I get more/better/faster
answers to questions there.

The folks there are good at helping with questions like this, regardless of
the 'context' (e.g., managed AutoCAD .NET or AutoCAD ActiveX programming).

In any case, the file at this link shows an example of looping while the
user continues to pick points, using the managed API and C#:

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

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295638@discussion.autodesk.com...
in my (admittedly demented) mind, the question was on the general loop
structure, 🙂
not whether i was using
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetPoint

versus
acadDoc.Utility.GetPoint
I will try to rewrite it in net api and repost
Thanks
mark


"Tony Tanzillo" wrote in message
news:6295570@discussion.autodesk.com...
You might also try posting questions about using ActiveX in the VBA/ActiveX
newsgroup.

The discussion here focuses mainly on using the managed ObjectARX API with
any .NET language. The VBA/ActiveX newsgroup focuses on using ActiveX from
VBA, VB, and other languages, including VB.NET.

--
http://www.caddzone.com

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

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6295554@discussion.autodesk.com...
How to loop until user quits picking points (escapes)
this works but don't know if there's a better way

Dim bGotPoint As Boolean

bGotPoint = True

Do While bGotPoint = True

Try

ptInsert = m_acadDoc.Utility.GetPoint(, "Pick Insertion Point(s) or escape
to cancel:")

Catch ex As Exception

bGotPoint = False

Exit Do

End Try

DoSomething(ptInsert)

Loop
Message 12 of 15
JanetDavidson
in reply to: Anonymous

Hello mp.

I have the same question like yours.

Could you please help me with that? or at least provide Tony Code ? Seems his website is down and I could not down load the code.

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

 

Thanks,

Janet,


 

Message 13 of 15

I guess you're asking for something like this...

 

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            Point3dCollection pts = new Point3dCollection();

            PromptPointOptions opts = new PromptPointOptions("\nPick point: ");
            opts.AllowNone = true;
            PromptPointResult result;
            do
            {

                result = ed.GetPoint(opts);
                if (result.Status == PromptStatus.OK)
                {
                    pts.Add(result.Value);
                    opts.BasePoint = result.Value;
                }
            } while (result.Status == PromptStatus.OK);

 

 

remove 'opts.AllowNone = true'  if you don't want the loop to end when the user hits enter/space bar.

remove opts.Basepoint... if you don't want the rubberband to display

 

BR

Paavo Rantanen

Message 14 of 15

Thank You Paavo,

Indeed It is what I want.

 

If I don't interrupt you, another question please. How could I have a Keyword Option in the middle of this loop.

Let's say , when prompts for picking a point if user press "G" then some functions take place and then comes back to loop ?

 

Thank you guys again.

Janet.

 

Message 15 of 15

Sure, look at the KeywordCollection member of PromptPointOptions class.

Kean Walmsley describes the procedure in this post:

 http://through-the-interface.typepad.com/through_the_interface/2010/05/adding-keyword-handling-to-au...

 

BR

Paavo Rantanen

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