TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ScottMC on August 15, 2018, 11:50:24 PM

Title: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 15, 2018, 11:50:24 PM
Hopes are I'll find more info or links to examples yet suggestions are appreciated as to the utilization of these acet commands. Turning off the 'shift to acquire' format for my use of 'OTRACK' would have to happen. I know it's just my lack of searching..
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: roy_043 on August 16, 2018, 04:25:10 AM
I have used these functions in odcl OnClicked events to enable multiple actions for a single control. But I think the functions can be used whenever you ask for user input. In BricsCAD these are built-in functions, but AutoCAD users will have to install the Express Tools.
Code: [Select]
(defun c:test ()
  (getstring "\nPress Enter or Shif+Enter: ")
  (if (acet-sys-shift-down) (princ "\nYou pressed Shif+Enter "))
  (princ)
)
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: CAB on August 16, 2018, 10:13:47 AM
Lots of info here:  Swamp Search
 (https://goo.gl/ZU5E9D)
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 16, 2018, 12:14:06 PM
In testing the suggestion, here's the results:
Command: _appload SH+CMD.lsp successfully loaded.

Command: test

Press Enter or Shif+Enter:     -> "Waited for me to press keys.."
; error: no function definition: ACET-SYS-SHIFT-DOWN    -> Results

This is the current [acad-cepted] loaded code:

Code: [Select]
(defun c:test ()
(vl-load-com)
 (arxunload "acetutil.arx")
 (arxload "acetutil.arx")
  (getstring "\nPress Enter or Shif+Enter: ")
  (if (acet-sys-shift-down) (princ "\nYou pressed Shif+Enter "))
  (princ)
)

So excited, this is going to be usable - in many ways! ?Do software companies
take/buy posted ideas off this site seeing as the team effort exhibited shows its
power so well? I'd rather the generosity used for the final effort of development,
design, production and efficiency etc. JMHO
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: roy_043 on August 16, 2018, 03:39:52 PM
Personally I would check and load the Express Tools somewhere else in the application. And I would not use (arxunload) directly followed by (arxload). Consider this instead:
Code: [Select]
(defun c:test ()
  (if (not acet-sys-shift-down) (arxload "acetutil.arx"))
  (getstring "\nPress Enter or Shif+Enter: ")
  (if (acet-sys-shift-down) (princ "\nYou pressed Shif+Enter "))
  (princ)
)
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: efernal on August 16, 2018, 06:27:43 PM
Code - Auto/Visual Lisp: [Select]
  1. ;; or
  2. (if (not (member "acetutil.arx" (arx)))(arxload "acetutil.arx"))
  3.  
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 16, 2018, 07:29:46 PM
Code - Auto/Visual Lisp: [Select]
  1. ;; or
  2. (if (not (member "acetutil.arx" (arx)))(arxload "acetutil.arx"))
  3.  

Yup it did conflict being loaded but efernal your checker solved that error. Now the challenge still exists for me.. I've never attempted to use the"Shif+Enter" in a command and it still shows the same error as above. This conflict has got me spilling the tool box to find out where it is.... and it's certainly GOOD to do as.. so many other treasures I wasn't looking for has been found as a result!
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: Grrr1337 on August 17, 2018, 04:07:19 AM
Works good with grread mouse button(s), and not with the keyboard ones (for grread) :

Code - Auto/Visual Lisp: [Select]
  1. (defun C:test ( / g s b ) ; this technique doesn't work with KBD keys
  2.   ('((x)(or (member x (arx))(arxload x))) "acetutil.arx")
  3.   (while (not s) (setq g (grread))
  4.     (and (or (= 25 (car g))(equal '(2 13) g)) (setq s t))
  5.     (and (= 3 (car g)) (setq b (+ (if (acet-sys-shift-down) 1 0) (if (acet-sys-control-down) 2 0)))
  6.       (cond
  7.         ( (= 3 (logand 3 b)) (princ "\nYou pressed Ctrl+Shift+LMB") )
  8.         ( (= 2 (logand 2 b)) (princ "\nYou pressed Ctrl+LMB") )
  9.         ( (= 1 (logand 1 b)) (princ "\nYou pressed Shift+LMB") )
  10.         ( (princ "\nYou pressed LMB") )
  11.       ); cond
  12.     ); and
  13.   ); while
  14.   (princ)
  15. ); defun
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 17, 2018, 10:50:03 PM
With this error repeating, must be I'm missing something having looked at my command list (acet..) it does exist. Got to have something to do with the results[out] of the command [nil or "T"] and how to use that. Running A2k. Still interesting to learn with y'alls assist.. Tks  :-D

 Command: test
; error: no function definition: ACET-SYS-SHIFT-DOWN
; reset after error

Command:
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: cmwade77 on August 22, 2018, 01:05:29 PM
With this error repeating, must be I'm missing something having looked at my command list (acet..) it does exist. Got to have something to do with the results[out] of the command [nil or "T"] and how to use that. Running A2k. Still interesting to learn with y'alls assist.. Tks  :-D

 Command: test
; error: no function definition: ACET-SYS-SHIFT-DOWN
; reset after error

Command:

Do you have Express Tools installed? If not, then you will always get this error.
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 22, 2018, 09:28:50 PM
From an earlier post http://www.theswamp.org/index.php?topic=48162.0 (http://www.theswamp.org/index.php?topic=48162.0) and test, seems my acetutil is loaded. Still the same error.. must be I'm trying to use this "ACET-SYS-SHIFT-****" in the wrong way. A similar "ACET-SYS-KEYSTATE KEYCODE" worked fine....

Code - Auto/Visual Lisp: [Select]
  1. (defun expresstools-p ( )
  2.     (or
  3.         (member "acetutil.arx" (arx))
  4.         (and (findfile "acetutil.arx") (arxload "acetutil.arx" nil))
  5.     )
  6. )

ALSO:
Code: [Select]
Command: (acet-reg-prodkey)
"Software\\Autodesk\\AutoCAD\\R15.0\\ACAD-1:409"


EDIT: Added code tags. - John
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: roy_043 on August 23, 2018, 04:13:55 AM
Maybe this helps:
Code: [Select]
(defun KGA_Sys_KeyStateGet_ShiftDown_P ()
  (or
    (minusp (acet-sys-keystate 160)) ; Left Shift.
    (minusp (acet-sys-keystate 161)) ; Right Shift.
  )
)
Title: Re: Like to utilize the acet-sys-shift/control-down commands
Post by: ScottMC on August 25, 2018, 10:40:53 PM
roy_043 you got it!! Major progress!! Now it's my part to get the program to use the results.  :-D

Works well but requires a restart of the command to change to "Extend" Also noticed (grread) could
solve the [shift mouse right-click ] conflict..
Code: [Select]
(defun C:tt (/ sset)           ;; Works to extend if, when done selecting, key: shift & right click/enter.
;; Removed a "key customization" in ***AUX2 which was used for a mouse
;; kbrd combo command [shift+right click/enter] Now shift right-click works

(setvar "cmdecho" 0)
  (princ " \nTrim or Extend")
  (setq sset (ssget))
 
  (if (> 0 (acet-sys-keystate 160))   
(progn
(command "extend" sset "")  ;shift + right click/[enter]
)
(command "trim" sset "")  ; right click/[enter]
  )
  (vl-load-com)
(setvar "cmdecho" 1)
)

 Will a command be allowed to change using a "while" loop?