Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

asherjoh
13868 Vistas, 13 Respuestas

PAN A SPECIFIC DISTANCE

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

pendean
en respuesta a: asherjoh

Use -PAN command (there is a dash in the name): after you start the command, click on screen, drag your cursor in the opposite direction of where you want to go to, then type in that exact distance and hit <enter>


asherjoh
en respuesta a: pendean

That works. Thank You

sophia_lee
en respuesta a: pendean

thank you, this is helpful. 


Sophia Lee
Global Product Support Specialist
ubul3
en respuesta a: asherjoh

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

Kent1Cooper
en respuesta a: ubul3


@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.

Kent Cooper, AIA
ubul3
en respuesta a: Kent1Cooper

Very nice, thank you!

I modified my macros and it works great.

 

Learning new things every day.

winziewaye
en respuesta a: pendean

Hi Pendean. 
Do you know if the second point can be refered to a specific point of the same viewport?

pendean
en respuesta a: winziewaye

@winziewaye point-selection in -PAN command works the same way as in other commands.
lucas_boisson
en respuesta a: ubul3

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, 

ubul3
en respuesta a: lucas_boisson

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.

 

New Project.png

 

New Project (1).png

For Mac users:

Clipboard01.jpg

lucas_boisson
en respuesta a: ubul3

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.

 

2023-04-12 16_47_46-Autodesk AutoCAD 2023 - [SP-PLAISIR-FICHIER MERE.dwg].png


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.

 

2023-04-12 16_52_50-Autodesk AutoCAD 2023 - [SP-PLAISIR-FICHIER MERE.dwg].png

If it can help, I'm on Autocad 2023.

 

Thank you,

ubul3
en respuesta a: lucas_boisson

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

 

lucas_boisson
en respuesta a: ubul3

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.