Page 1 of 1
GetPoint Object Error
Posted: Thu Mar 17, 2005 1:18 pm
by Julian
I am writing a simple VBA utility to add a sequence of property numbers to the screen. This is part of a larger routine for our software.
Simply put, the operator would enter a start number, then just pick a series of locations on the screen . The macro would then write an incrementing series of numbers to the screen at the locations picked.
I have stripped out all the fancy bits, included the dim statements etc and leave just the raw kernel for the purposes of this question. The problem is that the method “GetPoint” fails unless I insert a msgbox (essentially a break in program flow.) If I uncomment the msgbox, the macro works fine, but is very user-unfriendly.
The error message my system reports is:
Method “Getpoint” of object IIcadUtility failed
Sub InsertSingleErfNumbers()
Dim iDoc As IntelliCAD.Document
Dim iText As IntelliCAD.Text
Dim iPoint As IntelliCAD.Point
Dim iStartPoint As IntelliCAD.Point
Dim intJ As Integer
Dim intErfNumber As Integer
Set iDoc = IntelliCAD.ActiveDocument
intErfNumber = 1
For intJ = 1 To 10
'MsgBox (Str(intErfNumber))
Set iPoint = iDoc.Utility.GetPoint(, "Pick location ")
Set iText = iDoc.ModelSpace.AddText(Str(intErfNumber), iPoint, 1)
iText.Update
intErfNumber = intErfNumber + 1
Next intJ
End Sub
It appears that there may be an error in the GetPoint object when used repeatedly
OS tried both Win 98 and XP.
Any suggestions anyone?
Posted: Fri Mar 18, 2005 6:28 am
by bennieo
I added this line to your code:
Set iPoint = Nothing
Right before the "Next intJ" statement and it seems to work.
Thanks for bringing it up, I've been struggling with this same problem, but something in your post made me think about it in a new way.
Posted: Fri Mar 18, 2005 10:42 am
by Julian
Your suggestion of assigning Nothing to the Object, effectively resetting the object, is aiming us in the right direction. I tried your suggestion but unfortunately it failed on my XP system. Putting in an error trapping routine extracted the error of -214746259 for the GetPoint method. Who knows what this could be?!. John Green of CMS indicated to me that there might still be an old bug in the GetPoint method which should have been eliminated in this build - maybe one of the CMS gurus can enlighten us here.
An interesting point I noted when including your Nothing statement is that I managed to get 4 numbers onto the screen before the routine crashed, but that these were not consecutive like they should have been, but jumped by up to 6 integers, indicating that the loop continued without the Set iPoint = iDoc.Utility.GetPoint(, "Pick location ") line being executed. What we seem to need is some form of interrupting statement, that can break program flow like the msgbox does, but without the user being aware of this. I would have expected the Nothing statement to work.
The routine works fine in Autocad V14 - frustrating, as this is delaying me putting this package into the production environment.
Lets spend the weekend looking further!
Posted: Fri Mar 18, 2005 12:25 pm
by bennieo
I'm not sure what's happening. I just commented out the Nothing statement and it still worked. I'm using Win 98SE and Icad version 5.1.5 to test it.
I seen your earlier post about a registry problem created from another version. Could it be possible that there is still some sort of conflict there?
I'll try running it again tonight on an XP machine and will let you know the results.
Posted: Fri Mar 18, 2005 10:23 pm
by ssc
There was a problem with getpoint. I tried your code and had no problems, I even increased the count to 30 and still had no problems.
Running WinXP Pro
ssc
Posted: Sat Mar 19, 2005 7:16 am
by Julian
I re-installed the ProgeSoft version of IntelliCAD and tested the routine - works fine. I then removed the ProgeSoft and CMS versions using the uninstall facility, cleared the registry references, and re-installed CMS icad. No luck, still bombs.
Surely if the ProgeSoft version works on my machine, then the CMS version should work. I have VB6 on my system, running under XP Home. The CMS icad version is 5.1.5.0. It installs fine, no error messages during the installation, and the system is clear of any other versions of Icad.
I will try other options including testing on a Win 98 machine in my office, failing which I think I will have to arrange for another download of this package.
Thanks for the suggestions, but I think I have a localised type of error here. Unfortunately most of my Acad Lisp routines that I am converting will use the GetPoint object so this is a hurdle I must cross come what may!
Posted: Sun Mar 20, 2005 8:09 am
by Julian
Final update on this saga: I went to the office and tried the code out on an XP machine and the first thing that happened was a syntax error : str( not recognised, must be Cstr(. When that was changed, the routine ran fine.
Tried the same on my development machine at home, no luck. So the problem definetly seems to be some form of conflict with existing software on my development machine. When I get to the bottom of this I will post a closing message!.
Posted: Sun Mar 20, 2005 1:20 pm
by John Finlay
Julian,
Try a DoEvents in your code:
Sub InsertSingleErfNumbers()
Dim iDoc As IntelliCAD.Document
Dim iText As IntelliCAD.Text
Dim iPoint As IntelliCAD.Point
Dim iStartPoint As IntelliCAD.Point
Dim intJ As Integer
Dim intErfNumber As Integer
Dim i As Integer ' New Code ****************
Set iDoc = IntelliCAD.ActiveDocument
intErfNumber = 1
For intJ = 1 To 10
Set iPoint = iDoc.Utility.GetPoint(, "Pick location ")
'****** Start New Code **************
' DoEvents is used to allow more time for
' the operating system to process other operations
For i = 1 To 4
DoEvents
Next
'****** End New Code **************
Set iText = iDoc.ModelSpace.AddText(Str(intErfNumber), iPoint, 1)
iText.Update
intErfNumber = intErfNumber + 1
Next intJ
End Sub
------------------
Regards
John Finlay
Posted: Mon Mar 21, 2005 11:45 am
by Julian
Many thanks John, I will give it a go. I am off on holiday for the next week or so, so I will post an update when I get back. The other VB programs being developed, including selection set manipulation, importation and exportation of files and entity manipulations is absolutely flying. Very satisfying indeed!.
Posted: Thu Apr 28, 2005 4:48 am
by ENSIGN
I am getting a similar problem as you.
I have noticed that it works OK on Win XP Home or PRO, but gets the same error as you on Win XP Multimedia, could it be something to do with an operating system conflict. It would be interested to know what version of windows you are using.