| Author |
Message |
Mark Propst
Guest
|
Posted:
Fri Apr 01, 2005 7:49 am Post subject:
.GetEntity doesn't accept keywords? |
|
|
For a little routine to create dimstyles
I want to allow the user to select a viewport or enter a scale factor at the
command line
the line to allow selection of the viewport is like
oDoc.Utility.GetEntity opvp, vpt, "Pick viewport or <enter> to specify
dimscale "
so if they select a viewport, i read the scale factor and create style
accordingly.
If they hit enter, I trap the error and present the next prompt
dReturnDimScale = oDoc.Utility.GetReal("Please enter dimscale: ")
however, if they don't bother to read the prompts (very likely) they may
enter the dimscale
at the getentity line above
this acts the same as an enter
(throws the error "Method 'GetEntity' of object 'IAcadUtility' failed")
but i can't find a difference between
1) entering a value and then an enter
or
2) just an enter
what I want to know is if there is a way to detect what was entered at the
command line
before hitting the enterkey or spacebar
according to the docs,
..GetEntity does not accept keywords
so I don't know of a way to get the value they already put in at the command
line
when they were just supposed to hit the enter key (and put the value in the
next prompt line.)
do i have to trap all keystrokes some how and save the most recent
so that if they put a value on the command line and it was a valid numeric
value i don't have
to re-prompt them for the scale factor,
but if they just hit enter (like they're supposed to) then I give the next
prompt.
Actually it would be cleaner if they didn't have to hit enter and then enter
the value and hit
enter a second time.
so the question becomes
how can I have a line like
oDoc.Utility.GetEntity opvp, vpt, "Pick viewport or specify dimscale "
and have it either get the selection or read the input?
(it seems like InitializeUserInput isn't going to help with a .getEntity
call)
from the help:
The user-input methods that can accept keywords are: GetKeyword, GetInteger,
GetReal, GetDistance, GetAngle, GetOrientation, GetPoint, and GetCorner.
but maybe i'm misreading something
or one could use initializeuserinput and create a keyword list of all valid
scale factors
(seems like really bad idea) then use .getpoint to get a point then use the
point to get a selection set to get the entity
(seems like a really really bad idea)
it's no big deal, it works ok as it is, it's just if they don't read the
prompt and enter a value and then an enter then I reprompt them and they
have to enter a value again it is double work for them. :-)
any thoughts appreciated
:-)
tia
Mark
|
|
| Back to top |
|
 |
Jeff Mishler
Guest
|
Posted:
Fri Apr 01, 2005 7:49 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
"Mark Propst" <NoSpam@HereThanks.com> wrote in message
news:424c9d20_3@newsprd01...
<snip>
| Quote: | it's no big deal, it works ok as it is, it's just if they don't read the
prompt and enter a value and then an enter then I reprompt them and they
have to enter a value again it is double work for them. :-)
Well, the way I see these situations is like this: |
If the user is bothered by the sequence you have provided, they will adapt
to the way it is written.
Otherwise they don't care
Or they are really slow learners and deserve to do things twice....and I
doubt that this is the only thing they do twice in a day's work ;-) |
|
| Back to top |
|
 |
Mark Propst
Guest
|
Posted:
Fri Apr 01, 2005 9:04 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Hi Jeff,
True enough.
In my case, I sure don't want to imply I work with bad or lazy users.
That's not the case at all. We're a very small company here and everyone is
great, smart and tries their hardest. But it happened once with this
routine, (which has only just been put on the server recently), that a user
didn't see the enter part (to get to the next prompt) and just put in the
scale factor, so my first response was, well the user didn't follow
directions....
However on further reflection I realized that that's a much more intuitive
way for it to work anyway.
If I could overcome my limitation of not knowing how to do it, then a user
is free to use it either way.
(granted, saving one keystroke is only a small improvement)
but it still would seem nicer to be able to either pick a viewport or enter
a value in one response eh?
Thanks as always for your input.
Mark
"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:424ca475_2@newsprd01...
| Quote: | "Mark Propst" <NoSpam@HereThanks.com> wrote in message
news:424c9d20_3@newsprd01...
snip
it's no big deal, it works ok as it is, it's just if they don't read the
prompt and enter a value and then an enter then I reprompt them and they
have to enter a value again it is double work for them. :-)
Well, the way I see these situations is like this:
If the user is bothered by the sequence you have provided, they will adapt
to the way it is written.
Otherwise they don't care
Or they are really slow learners and deserve to do things twice....and I
doubt that this is the only thing they do twice in a day's work ;-)
|
|
|
| Back to top |
|
 |
Jürg Menzi
Guest
|
Posted:
Fri Apr 01, 2005 10:03 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Hi Mark
In opposite to the help, GetEntity accepts keywords:
| Code: |
Public Function MeExtEntSel(ByVal UsrPmt As String, ByVal KeyWrd As String, _
RetVal As Variant, PicPnt As Variant) As Boolean
Dim UtlObj As AcadUtility
Dim CurEnt As AcadEntity
On Error GoTo Err_Control
MeExtEntSel = True
Set UtlObj = ThisDrawing.Utility
With UtlObj
.InitializeUserInput 0, KeyWrd
.GetEntity CurEnt, PicPnt, vbCrLf & UsrPmt
End With
Set RetVal = CurEnt
Exit_Here:
Exit Function
Err_Control:
Select Case Err.Number
Case -2145320928
Err.Clear
RetVal = UtlObj.GetInput
Case Else
Err.Clear
MeExtEntSel = False
End Select
End Function |
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch |
|
| Back to top |
|
 |
Mike Tuersley
Guest
|
Posted:
Fri Apr 01, 2005 10:03 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Do a search for GetXX, download it and incorporate it. It works around the
limitations of the vanilla GetX methods, and, if I remember correctly,
it'll handle your situation.
On our side topic here, being a full time developer I've run across many
poor, bad, lazy and just plain stupid users. While many times I would have
loved to cram my solution down their throats, that doesn't gain you any
notoriety or respect. If they see you are trying to accomodate them, it
makes the whole process easier and easier. Plus, you don't learn anything
either if you don't try to get around an issue such as this.
There's also the fact that no matter how clear and streamlined a coder's
gui design is, no one else ever sees it that way - but we won't go into
that ;-)
-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon... |
|
| Back to top |
|
 |
fantum
Guest
|
Posted:
Fri Apr 01, 2005 6:13 pm Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
| GetEntity will accept keywords. It will not accept arbitrary input (Utility.InitializeUserInput 128). When a non-keyword alphabetic string is entered "*Invalid selection*" is displayed at the command line and the prompt is repeated. When a numeric string that can't be interpreted as a point is entered an error (&H80020009 (-2147352567) : Method 'GetEntity' of object 'IAcadUtility' failed.) is thrown. You can trap that error and parse the "LASTPROMPT" system variable to retrieve the numeric string if one was entered. |
|
| Back to top |
|
 |
Mark Propst
Guest
|
Posted:
Sat Apr 02, 2005 10:00 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Thanks very much.
:-)
Mark
"Mike Tuersley" <mtuersley_NOT_@rand.com> wrote in message
news:1dpiserncqnqw$.1pmz793oah2cx.dlg@40tude.net...
| Quote: | Do a search for GetXX, download it and incorporate it. It works around the
limitations of the vanilla GetX methods, and, if I remember correctly,
it'll handle your situation.
On our side topic here, being a full time developer I've run across many
poor, bad, lazy and just plain stupid users. While many times I would have
loved to cram my solution down their throats, that doesn't gain you any
notoriety or respect. If they see you are trying to accomodate them, it
makes the whole process easier and easier. Plus, you don't learn anything
either if you don't try to get around an issue such as this.
There's also the fact that no matter how clear and streamlined a coder's
gui design is, no one else ever sees it that way - but we won't go into
that ;-)
-- Mike
___________________________
Mike Tuersley
___________________________
the trick is to realize that there is no spoon... |
|
|
| Back to top |
|
 |
Mark Propst
Guest
|
Posted:
Sat Apr 02, 2005 10:03 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Awesome,
Muchisimas Gracias.
Danka (?)
Thank you.
Mark
| Quote: | RetVal = UtlObj.GetInput
|
"Jürg Menzi" <info@menziengineering.ch> wrote in message
news:424D00E0.6702B24C@menziengineering.ch...
| Quote: | Hi Mark
In opposite to the help, GetEntity accepts keywords:
| Code: |
Public Function MeExtEntSel(ByVal UsrPmt As String, ByVal KeyWrd As
String, _
RetVal As Variant, PicPnt As Variant) As
Boolean
Dim UtlObj As AcadUtility
Dim CurEnt As AcadEntity
On Error GoTo Err_Control
MeExtEntSel = True
Set UtlObj = ThisDrawing.Utility
With UtlObj
.InitializeUserInput 0, KeyWrd
.GetEntity CurEnt, PicPnt, vbCrLf & UsrPmt
End With
Set RetVal = CurEnt
Exit_Here:
Exit Function
Err_Control:
Select Case Err.Number
Case -2145320928
Err.Clear
RetVal = UtlObj.GetInput
Case Else
Err.Clear
MeExtEntSel = False
End Select
End Function |
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch |
|
|
| Back to top |
|
 |
Mark Propst
Guest
|
Posted:
Sat Apr 02, 2005 10:03 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
Highly excellent.
Thank you.
That's funny I didn't even think to try it when the help didn't include it
in its list.
Duh!
Thanks
Mark
"fantum" <nospam@address.withheld> wrote in message
news:10804683.1112361229735.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | GetEntity will accept keywords. It will not accept arbitrary input
(Utility.InitializeUserInput 128). When a non-keyword alphabetic string is |
entered "*Invalid selection*" is displayed at the command line and the
prompt is repeated. When a numeric string that can't be interpreted as a
point is entered an error (&H80020009 (-2147352567) : Method 'GetEntity' of
object 'IAcadUtility' failed.) is thrown. You can trap that error and parse
the "LASTPROMPT" system variable to retrieve the numeric string if one was
entered. |
|
| Back to top |
|
 |
Jürg Menzi
Guest
|
Posted:
Sat Apr 02, 2005 4:47 pm Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
| Quote: | Muchisimas Gracias.
Alegre ayudarle...¦-)
Danka (?) -> Danke
Freut mich zu helfen...¦-)
Thank you.
Glad to help you...¦-) |
My sample doesn't have a error handling for 'pick nothing', 'Enter', etc.
Check the GetXXX functions (see Mike's answer) to get more information.
Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch |
|
| Back to top |
|
 |
MP
Guest
|
Posted:
Mon Apr 04, 2005 6:42 am Post subject:
Re: .GetEntity doesn't accept keywords? |
|
|
I've never used the lastprompt var before.
It seems kinda weird here -
I only get the last word or two returned
eg
" dimscale 12"
(if 12 had been entered at the command line)
Then I tried to look it up to see how it's supposed to work and I can find
no topics in acad help
(2004 here.)
Is that an undocumented variable?
so I'd have to get the last part of the string, test for numeric value and
then use that -
I'll look into that.
Thanks
Mark
"Nathan Taylor" <nospam@address.withheld> wrote in message
news:17324285.1112326536715.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | This might work.
If ThisDrawing.GetVariable("LASTPROMPT") = "Command: Pick viewport or
enter> to specify dimscale" Then
Regards - Nathan |
|
|
| Back to top |
|
 |
|
|
|
|