Disable pan zoom and rotate with AutoHotKey v1

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

Post Reply
Programinator
Posts: 3
Joined: Mon May 12, 2025 5:00 am

Disable pan zoom and rotate with AutoHotKey v1

Post by Programinator »

I have a script that I use. I'm on Windows 10. When i run the script and while it is in the process of running I use the pan/zoom or rotate with my spacemouse pro it will crash the script. So im wondering if i can somehow programmatically disable and enable either the whole spacemouse pro or just the pan/zoom and rotate.

Thanks
jwick
Moderator
Moderator
Posts: 3417
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Disable pan zoom and rotate with AutoHotKey v1

Post by jwick »

If a consistent executable is crashing, you can create a cfg for it and disable all the axes.
Programinator
Posts: 3
Joined: Mon May 12, 2025 5:00 am

Re: Disable pan zoom and rotate with AutoHotKey v1

Post by Programinator »

let me be a little more specific. Im useing a program called Mastercam which i use the SpaceMouse pro for. I also have a custom script that i use for mastercam. So i hit a certain macro and it will tell the script to run a certain task in mastercam. some of the tasks take a while to run. So if in the middle of running a task with the script i accidentally hit the spacemouse pro's knob it will mess with the running of my script and it will freeze whatever it running. So what i want to do is programmatically disable the knob when i hit the macro key until the script is done running at which point it will return to normal.

for example here is a part of my script that will run when i hit f21. so just after the f21 i would put something that would disable and just before the return at the end i would put something that would reenable.

{ ;--------------------regen--------------------------------------------------------------
F21::
{
windows := ["Chain Manager", "Solid Chaining", "Function Panel", "Wireframe Chaining"]
windowFound := false

for _, window in windows {
if WinActive(window) {
windowFound := true
if (window = "Chain Manager")
ChainManagerActions()
else if (window = "Solid Chaining")
SolidChainingActions()
else if (window = "Function Panel")
FunctionPanelActions()
else if (window = "Wireframe Chaining")
WireframeChainingActions()
break
} else if WinExist(window) {
windowFound := true
WinActivate %window%
Sleep 100
if (window = "Chain Manager")
ChainManagerActions()
else if (window = "Solid Chaining")
SolidChainingActions()
else if (window = "Function Panel")
FunctionPanelActions()
else if (window = "Wireframe Chaining")
WireframeChainingActions()
break
}
}

if (!windowFound) {
if WinExist("Toolpaths") {
WinActivate Toolpaths
Sleep 100
}
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}
return
}

ChainManagerActions()
{
ControlFocus Button6, Chain Manager
ControlSend Button6, {Space}, Chain Manager
Sleep 100
if WinExist("Toolpaths") {
WinActivate Toolpaths
Sleep 100
}
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}

SolidChainingActions()
{
ControlFocus Button30, Solid Chaining
ControlSend Button30, {Space}, Solid Chaining
Sleep 100 ; Increased wait time for window transitions

if WinExist("Chain Options") {
WinActivate Chain Options
WinWaitActive Chain Options
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}
else {
Sleep 100 ; Additional wait to ensure Chain Manager has time to appear
if WinExist("Chain Manager") {
WinActivate Chain Manager
WinWaitActive Chain Manager, , 2 ; Added timeout of 2 seconds
if !ErrorLevel ; Check if WinWaitActive succeeded
{
Sleep 100 ; Brief pause after activation
ControlFocus Button6, Chain Manager
ControlSend Button6, {Space}, Chain Manager
WinActivate Toolpaths
WinWaitActive Toolpaths
Sleep 100
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}
}
}
}

FunctionPanelActions()
{
WinActivate, Toolpaths,
WinWaitActive, Toolpaths,

WinActivate, Function Panel,
WinWaitActive, Function Panel,
Sleep 100
Send {Tab 3}
Send {Space}
WinActivate Toolpaths
WinWaitActive Toolpaths
Sleep 100
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}

WireframeChainingActions()
{
ControlFocus Button35, Wireframe Chaining
ControlSend Button35, {Space}, Wireframe Chaining
Sleep 100 ; Increased wait time for window transitions

if WinExist("Chain Options") {
WinActivate Chain Options
WinWaitActive Chain Options
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}
else {
Sleep 100 ; Additional wait to ensure Chain Manager has time to appear
if WinExist("Chain Manager") {
WinActivate Chain Manager
WinWaitActive Chain Manager, , 2 ; Added timeout of 2 seconds
if !ErrorLevel ; Check if WinWaitActive succeeded
{
ControlFocus Button6, Chain Manager
ControlSend Button6, {Space}, Chain Manager

WinActivate Toolpaths
WinWaitActive Toolpaths

Sleep 100 ; Brief pause after activation
Send {Ctrl Down}{Alt Down}r{Alt Up}{Ctrl Up}
}
}
}
}

}
jwick
Moderator
Moderator
Posts: 3417
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Disable pan zoom and rotate with AutoHotKey v1

Post by jwick »

It sounds like a problem the Mastercam developers would like to know about. There should not be an issue with getting 3D mouse data in the middle of a script -- it might need to be ignored. I can imagine it has not been encountered before.
(edit: It seems that this is wrong. It doesn't appear to be a MasterCam problem)

In the meantime, you can use a script to disable/enable the Axes.
%appdata%/3Dconnexion/3DxWare/Cfg/Mastercam.xml will need to be edited.

Send me an email and we will work out the details.
Programinator
Posts: 3
Joined: Mon May 12, 2025 5:00 am

Re: Disable pan zoom and rotate with AutoHotKey v1

Post by Programinator »

jwick wrote: Tue May 13, 2025 12:25 am It sounds like a problem the Mastercam developers would like to know about. There should not be an issue with getting 3D mouse data in the middle of a script -- it might need to be ignored. I can imagine it has not been encountered before.

In the meantime, you can use a script to disable/enable the Axes.
%appdata%/3Dconnexion/3DxWare/Cfg/Mastercam.xml will need to be edited.

Send me an email and we will work out the details.
ok. thanks. What is your email address?
jwick
Moderator
Moderator
Posts: 3417
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Disable pan zoom and rotate with AutoHotKey v1

Post by jwick »

I sent an email to you at yahoo.com.
Post Reply