Manipulating options during [GRREAD]

Manipulating options during [GRREAD]

Muhammed.OPERA
Advisor Advisor
4,342 Views
31 Replies
Message 1 of 32

Manipulating options during [GRREAD]

Muhammed.OPERA
Advisor
Advisor

Hi everybody,

I've been using (grread) function and i managed to manipulate everything if the answer to the function is by picking a point or typing a string in the command line but here's the problem:

If i clicked any button in the text printed during the work of (Grread) function, it always returns (11 -1) and that return doesn't change with changing the clicked button.

How can i determinate which button the user clicks from the command line to know which rootline to take ????!

Thanks in advance.


Muhammed Mamdouh (OPERA)
Structural Engineer, Instructor
Facebook |LinkedIn

EESignature

0 Likes
4,343 Views
31 Replies
Replies (31)
Message 21 of 32

john.uhden
Mentor
Mentor
@Kent1Cooper
Not exactly. LO is clearly different from LW and LT, so an Enter would not
be required, but it does leave some programming trouble to handle a
backspace if the user mistyped.

John F. Uhden

0 Likes
Message 22 of 32

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:
Not exactly. LO is clearly different from LW and LT, so an Enter would not be required....

Pay attention now, John -- the option abbreviation in -LAYER for Linetype is not LT, it's just L.  [Maybe you're confusing it with the options in CHPROP, or CHANGE's Properties option, where the abbreviation for Linetype is LT.]  Read the first sentence in my previous Reply again, especially the part between the commas.  Enter [or some other confirmation] would be required if you wanted to use that option, because if pressing L under (grread) gets you directly into the Linetype option, you can never use the LO or LW options.

Kent Cooper, AIA
0 Likes
Message 23 of 32

john.uhden
Mentor
Mentor
Pay attention, Kent.
I was agreeing with you.
But you could intertwine a little DCL for get_this and get_that, etc.

John F. Uhden

0 Likes
Message 24 of 32

Muhammed.OPERA
Advisor
Advisor

I appreciate your enthusiasm @john.uhden @Kent1Cooper @ВeekeeCZ @CADaSchtroumpf 

But try to understand me please, i'm building a routeline to get a realtime preview of the object during the selection, that leads me to use {Grread} only, that's the only way i see to get that responce, not for the one key clicking advantage {the enter clicking isn't such burden} and that means i can't use {Initget} with any {getxxx} functions.

{Getxxx} functions are really cool but during those functions we can't get a realtime preview of anything.

I searched every way i can reatch to accomplish a realtime preview like any AutoCAD original command like: Line, circle, ... etc. but i found that no one is programming such commands except LEE MAC (who i consider as a legend myself), and i saw he avoid getting through that point i'm asking for. He avoid letting the user select any option from the command line in every LISP file he wrote that use realtime preview.

For example, see that: http://www.lee-mac.com/star.html

If you tried to draw that star it's working excellent but with keyboard clicking to increase the star branches and other stuff, but if you clicked the button from the command line here's the problem.

Do anyone know how to deal with the (11 -1) return??!

As you see, that's the only way to get the realtime preview.


Muhammed Mamdouh (OPERA)
Structural Engineer, Instructor
Facebook |LinkedIn

EESignature

0 Likes
Message 25 of 32

john.uhden
Mentor
Mentor
I am obviously missing something. Please describe what you mean by a "real
time preview."
I thought there was a 3DROTATE command, though I've never had reason to use
it.

John F. Uhden

0 Likes
Message 26 of 32

Muhammed.OPERA
Advisor
Advisor

If you use line command after specifying the first point there's a line vector attached to the curser as you move. that's the realtime preview i mean. that happens with any original AutoCAD command. If you used circle command and specified the center point, the circle vector is drawn and dynamically changes with the move of the curser till you enter the radius or select a point.


Muhammed Mamdouh (OPERA)
Structural Engineer, Instructor
Facebook |LinkedIn

EESignature

0 Likes
Message 27 of 32

john.uhden
Mentor
Mentor
So the LINE and CIRCLE and SCALE commands aren't good enough, eh?
The way I see the potential answer to your problem, say with a line, is to
create the line and with grread running modify its endpoint (10 or 11) as
the cursor is moved. The same way you could modify the radius of a circle
or the height of text or other properties, though scaling a complex block
insertion might be a little jerky. I know I've done this successfully for
some purpose, but I don't remember what. These days if it doesn't improve
my work efficiency, I don't much bother.to play except if something here
intrigues me.

John F. Uhden

0 Likes
Message 28 of 32

Kent1Cooper
Consultant
Consultant

@Muhammed.OPERA wrote:

If you use line command after specifying the first point there's a line vector attached to the curser as you move. that's the realtime preview i mean. ....


In the case of a LINE or a RECTANGle, you can get the preview you describe using (getxxx) functions.  Just include the 'pt' argument in the functions that have it, for the typical line vector ["rubber-banding"] for a Line using (getpoint) [and while it's not the typical drawn-object preview, you can also get the rubber-banding line in (getdist) and (getangle) functions], and the typical dynamic rectangle box-vector using (getcorner).  Then you can use (initget) for options that work just like those in typical AutoCAD commands, with the realtime preview.  But in the case of a Circle [and various other things], I don't know of a realtime preview involving (getxxx) functions.

Kent Cooper, AIA
0 Likes
Message 29 of 32

john.uhden
Mentor
Mentor
True, but you don't want to use the getxxx functions, so mimic them
yourself.
For the line example, start with a zero length line (10 = 11) and modify
one or the other as grread tracks your cursor. You do know about tracking,
right?
As you move your cursor you can even pick up objects using nentselp and use
your own glyphs to show any object snaps you want (er, that you can
calculate). I'll give you the glyph help when you're ready.
One sad shortcoming of AutoLisp/Visual Lisp is the inability to move the
cursor and/or hot grip a point on an object. At least I am not aware of
such capability.

John F. Uhden

0 Likes
Message 30 of 32

john.uhden
Mentor
Mentor

@Muhammed.OPERA 

Here's a little demo of what you can do with grread...

(defun c:demo ( / fuzz e ent done errobj code key p ans Vctr Vsize)
  ;; GRREAD demo by John Uhden (12-28-2020)
  ;; Ignore Vctr and Vsize for now.  We need them later for glyphs
  (setq fuzz 1e-6)
  (and
    (setq p (getpoint "\nLine starting point: "))
    (setq e (entmakex (list '(0 . "LINE")(cons 10 p)(cons 11 p))))
    (setq ent (entget e))
    (princ "\nDrag to endpoint: ")
    (while (and (not done)  ;; added ESC catch of grread (01-26-01)
                (setq errobj (vl-catch-all-apply 'grread (list 1 11 0))))
       (if
          (or
             (not (equal Vctr (getvar "viewctr") fuzz))
             (not (equal Vsize (getvar "viewsize") fuzz))
          )
          (setq v1 nil
                v2 nil
                Vctr  (getvar "viewctr")
                Vsize (getvar "viewsize")
          )
       )
       (if (vl-catch-all-error-p errobj)
          (setq code '(2 27)) ; 'ESC
          (setq code errobj)
       )
   ;    (princ code)(princ " ")
       (setq etyp nil
             key (cadr code)
       )
       (cond
          ((= key 3)
             (setq done 1 ans "Exit")
          )
          ((= key 27)
             (setq done 1 ans "Exit")
          )
          ((= (car code) 3) ; 3=pick
             (setq p key)
             (entmod (subst (cons 11 p)(assoc 11 ent) ent))
             (setq done 1)
          )
          ((= (car code) 5) ; 5=track
             (setq p key)
             (entmod (setq ent (subst (cons 11 p)(assoc 11 ent) ent)))
             (entupd e)
          )
       )
    )
  )
  (princ)
)

There are no error or undo controls.

John F. Uhden

0 Likes
Message 31 of 32

Kent1Cooper
Consultant
Consultant

@Muhammed.OPERA wrote:

If i clicked any button in the text printed during the work of (Grread) function, it always returns (11 -1) and that return doesn't change with changing the clicked button. ....

Do anyone know how to deal with the (11 -1) return??! ....


That's what it all boils down to.  In the AutoLisp Reference, it says the 11 means it's from an "AUX menu item," which apparently [undocumented] includes picking in a prompt in the command line.  But the ranges of values for the second number do not even include -1 [they're all from zero upward] -- the -1 could mean it's from picking in the prompt, rather than pressing an AUX menu button as the number-range values indicate.  But if it's -1 no matter which option you pick, there does not appear to be any further breakdown that could identify that option.

 

HOWEVER, when 11 is the first number, there's a:

  Note: SHORTCUTMENU must be set to a value of 0.

Is yours set to 0?  If not, try setting that to 0, and see whether the (grread) return has any different second number than -1.

Kent Cooper, AIA
0 Likes
Message 32 of 32

john.uhden
Mentor
Mentor

Wow, Kent!

If that is the key to his solution, then you have provided invaluable inside information!

I can hardly wait to find out if that helped him make any progress because it could be for many of us.

Many thanks!

John F. Uhden

0 Likes