Crashing AutoCAD 2009 any time I prompt for user input

Crashing AutoCAD 2009 any time I prompt for user input

AdammReilly
Collaborator Collaborator
531 Views
4 Replies
Message 1 of 5

Crashing AutoCAD 2009 any time I prompt for user input

AdammReilly
Collaborator
Collaborator

I'm running Civil 3D 2009, and Visual Basic 2008 Express.

I was going to work on a small project, but I've run several test programs to prompt for different user input methods. Every time I prompt for user input at all, Autocad crashes.

I need some help. Everything looks correct, and I'm getting pretty irritated at this.

 

This is the code I have:

 

 

Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.ApplicationServices.Application
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports DbTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager
Imports Autodesk.AutoCAD.EditorInput
Public Class HCE_Tools
    <CommandMethod("TestString")> _
    Sub WriteStringToUser()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        ed.WriteMessage("Hello World!")
    End Sub
    <CommandMethod("TestPoint")> _
Sub PromptUserForPoint()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim prPtOpts As New PromptPointOptions(vbLf + "Pick a point:")
        prPtOpts.AllowNone = True 'Allow ENTER only
        prPtOpts.AppendKeywordsToMessage = False
        Dim prPtResult As PromptPointResult
        prPtResult = ed.GetPoint(prPtOpts)            <---- This is where it always crashes at
        ed.WriteMessage(prPtResult.ToString)
    End Sub
End Class
Adam Reilly

Civil 3D 2026
Creator A16 AI+ A3HVFG
Windows 11 Pro
AMD Ryzen AI 9 365 w/ Radeon 880M
LinkedIn


Group Leader badge

Austin CADD User Group

LinkedIn | Discord


Please select the Accept as Solution button if my post solves your issue or answers your question.
0 Likes
532 Views
4 Replies
Replies (4)
Message 2 of 5

fieldguy
Advisor
Advisor

The 1st argument for New PromptPointOptions is messageandkeywords as string.  My guess is it doesn't like your input.  Try it this way:

Dim prPtOpts As PromptPointOptions = New PromptPointOptions("")

prPtOpts.Message = vbLf & "Pick a point:"

 

 

0 Likes
Message 3 of 5

AdammReilly
Collaborator
Collaborator

That didn't do it. Still got the same error.

Can't seem to catch the error either.

Adam Reilly

Civil 3D 2026
Creator A16 AI+ A3HVFG
Windows 11 Pro
AMD Ryzen AI 9 365 w/ Radeon 880M
LinkedIn


Group Leader badge

Austin CADD User Group

LinkedIn | Discord


Please select the Accept as Solution button if my post solves your issue or answers your question.
0 Likes
Message 4 of 5

chiefbraincloud
Collaborator
Collaborator

I don't think this is going to be helpful at soothing your irritation, but I pasted your TestPoint Function into my code and ran it, it worked fine.  There were two things I was going to look at, one being that in VB, I prefer to use the & instead of + to concatenate strings, the other was setting AppendKeywordsToMessage to false without any keywords, but it doesn't seem to have a problem with either.

 

My Text Window output:

 

Command: testpoint

Pick a point: ((OK,),(5.84749117416629,4.5328068004761,0))
Command:  TESTPOINT
Pick a point: ((OK,),(4.30410913085712,3.24291119397888,0))
Command:  TESTPOINT
Pick a point: *Cancel*
((Cancel,),(0,0,0))
Command:  TESTPOINT
Pick a point:
((None,),(0,0,0))

Command:
TESTPOINT
Pick a point: fred

Invalid point.

Pick a point: f

Invalid point.

Pick a point: *Cancel*
((Cancel,),(0,0,0))

 

I was running this in AutoCAD 2010, but I used 2009 for two years, and I didn't have any wierd problems getting user input.

Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 5 of 5

fieldguy
Advisor
Advisor

Your code works as is for me - in acad 2011.  I do not have 2009 installed anymore.

 

Good luck!

0 Likes