- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Denunciar
I am in layout. And I activate a view port. Then I pan the model. Is there a way to pan a specific distance? Thank You
¡Resuelto! Ir a solución.
The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.
I am in layout. And I activate a view port. Then I pan the model. Is there a way to pan a specific distance? Thank You
¡Resuelto! Ir a solución.
That works. Thank You
thank you, this is helpful.

For this I use this little LISP combined with macros.
USERR1 and USERR2 variables are saved in the drawing.
(defun c:PD ( / d1 d2) ;define variables
(initget 6) ;0 input and negative values not allowed (6 = 2 + 4)
(setq d1 (getreal "\nVertical distance : "))
(setvar "USERR1" d1)
(initget 6)
(setq d2 (getreal "\nHorizontal distance : "))
(setvar "USERR2" d2)
;(princ "\nVertical: " d1)
;(princ "\nHorizontal: " d2)
(princ)
)
Just create new commands in CUI with your own name and description and copy the corresponding macro line to the macro field. For panning I use Ctrl+arrows.
PanDOWN
^C^C-pan 0,0 0,$M=$(getvar,userr1)
PanUP
^C^C-pan 0,0 0,$M=-$(getvar,userr1)
PanLEFT
^C^C-pan 0,0 $M=$(getvar,userr2),0
PanRIGHT
^C^C-pan 0,0 $M=-$(getvar,userr2),0
If you want to use the stored value to not just pan, but copy, you can create new commands like:
Copy UP
^C_copy 0,0,0 0,$M=$(getvar,userr1),0
Copy DOWN
^C_copy 0,0,0 0,$M=-$(getvar,userr1),0
@ubul3 wrote:
....
PanDOWN
^C^C-pan 0,0 0,$M=$(getvar,userr1)
PanUP
^C^C-pan 0,0 0,$M=-$(getvar,userr1)
PanLEFT
^C^C-pan 0,0 $M=$(getvar,userr2),0
PanRIGHT
^C^C-pan 0,0 $M=-$(getvar,userr2),0....
PAN can be a transparent command. So if you don't put the ^C^C cancellations at the beginning of those macros, but precede them with the apostrophe for transparent use instead, you can use them even in the middle of another command such as between point designations while drawing a Line or Polyline, during a Move or Copy command, etc.
But since doing it by giving points will be subject to possible running Object Snap throwing off the result, if you want precise movement they are better done with the displacement-followed-by-Enter approach, which is not subject to that:
PanDOWN
'_.-pan 0,$M=$(getvar,userr1) ;
PanUP
'_.-pan 0,$M=-$(getvar,userr1) ;
PanLEFT
'_.-pan $M=$(getvar,userr2),0 ;
PanRIGHT
'_.-pan $M=-$(getvar,userr2),0 ;
Or, with _none Osnap calls before the two points:
PanDOWN
'_.-pan _non 0,0 _non 0,$M=$(getvar,userr1)
etc.
Very nice, thank you!
I modified my macros and it works great.
Learning new things every day.
Hi Pendean.
Do you know if the second point can be refered to a specific point of the same viewport?
Hello,
I'm sorry, i'm new to the use of LISP and macros. What do I do with this code ? I successfully added my macros in my CUI, but I don't know how to use the previous code.
I'd be glad if you can help me.
Thank you very much,
First, drag & drop the desired command into the shortcut keys list then select it and add a shortcut key to it. See the attached images.
Note: On Mac you can not add shortcut keys to macros (some kind of system limitation). The only way is to use macros is to create Toolbar buttons. The process is quite similar, create you own toolbar in the CUI and drop the desired command in there.
For Mac users:
Thank you for your quick answer.
Yes, I did something like that already.
I did everything again the way you told me (see the picture attached) but it still dosen't work.
As I have never touch a single LISP or code before, I may have skipped an obvious step or something like that..
I entered the "USERR1" variable the way you can see on the second picture.
If it can help, I'm on Autocad 2023.
Thank you,
It should work now. Did you get any error messages in the command line.
If I pan up and down with these shortcuts, I get the following:
Command: '_-pan Specify base point or displacement: 0,0 Specify second point: 0,-500
Command: '_-pan Specify base point or displacement: 0,0 Specify second point: 0,500
Well, I managed to make it work by changing the affected shortcuts.
Firstly, I attached it to the arrow keys, then to the 8, 4, 6, 2 keypad numbers. That didn't work, no lines appeared on the command line.
I wanted to try another way, so I affected a new macro to a random shortcut (Ctrl+H), and it kind of worked because the new macro wasn't working well, but the macro we talked about worked just fine.
I think there is maybe some kinda conflict with other shortcuts when using arrow keys or keypad numbers.
Anyway, thank you very much for your help.