The View.MousePositionX,Y is read only. How to set the mouse to the center using script? I hope I do not need to use MotionGfx to do so as I do not need to draw any motion graphics.
What is your use case for doing this? I ask because in AATK I have examples of moving to a certain point on the screen and I use the Tenative Snap point. The FlipChip DRC scripts has some examples but, I have never tried to center the mouse in a random view of the screen..
I just want a better way to pan view. The default using the middle roller vheel to both pan and zoom is quite difficult to use. Using the script, I can use the viewObj.Pan method, but it does not center the mouse, so I have to find a way to center it.
Use a roller ball mouse instead of that whacky IBM mouse with the middle dongle stick and turn your Pan sensitivity down to 4 (At the bottom of the Display Control General menu)
I have a few customers that use whacky mice and they are not made for doing this type of work. I have always used a Logitech, I am on my 3rd one over 18 years. My last one I wore all the markings off it and used it until the USB cord finally gave up.
+1 on the Logitech mice. I use the Performance Mouse MX. The wheel button works very well. One caveat - it has this horizontal scroll mode where if you press the wheel to one side or the other, it's supposed to go that way in programs like Excel. It's very sensitive. So I set the wheel button, and the left and right pan modes to "middle button" and it works great. This way no matter how I press on the wheel, it always behaves the same.
It also has 4 programmable thumb buttons. I use them for Copy, Paste, Enter, and Back. Saves tons of time when copying and pasting or when I need to accept a dialog without moving the mouse to the OK button.
Yes, I am using the Logitech Performance MX also. But the middle button is integrated with the scroll wheel. So if I pan with the middle button, I might inadvertenly zoom also. Of course, I can assign a button to be the same as the middle button using SetPoint, but I am still not used to pan dynamically. I want to be able to pan statically, that is, point the mouse to a location and click a button to zoom there, or something like the Adobe PDF viewer using the hand tool is also good. I do not like the screen moving without moving my mouse. I think this pan method was originally in Microsoft Windows more than 10 years ago for viewing long documents when mice start to have a middle button. But I never use this method to view large document, and instead, just use the page-up and page-down key on the keyboard.
Here ya go, I wrote this in VX so the ActiveViewEx may be ActiveView in 7.9.x:
Dim view As MGCPCB.viewSet view = pcbDoc.ActiveViewEx
x = view.CenterXy = view.CenterY
Call view.Pan(x + 1000, y + 0)
That is for Expedition, are you looking for Dx or Expedition code?
Great, I want to use this in Expedition layout. But we will get VX soon anyway.
However, I found that this pan method only works just after Expedition starts at "place mode". It fails to work after I change to "route mode". I think the <Ctrl>/left mouse click combination might be used by Expedition for other purpose, so that is why it does not work. If there is a way to use a keyboard event, it will also work for me as I can assign my MX mouse to a key, but I tried using the virtual key event in scripting and cannot get it to work.
Set ccmd = app.Gui.RegisterCommand("Pan View", True)
Call Scripting.AttachEvents(ccmd, "ccmd")
Function ccmd_OnMouseClk (eButton, eFlags, dX, dY)
Set viewObj = docObj.ActiveViewEx
If ( (eButton = epcbMouseButtonLeft) And (eFlags = epcbKeyboardFlagsCntrlPressed) ) Then
You aren't crazy, you can't set the left mouse button but you can set a keyboard key. Look in AATK/Menu at the AatkKeyStrokeMenu.vbs file.
Thanks for your tips. Now it works great by assigning one of the Logitech MX mouse button to a key, then using that key for panning. The only problem is that I still cannot center the mouse after panning, but now instead of panning to the exact mouse location, I pan to half of the distance between the mouse and the view center, and it feels much better this way.
Retrieving data ...