Writing script for -pan up - specified amount

I need a script for panning up by a set amount, It works using -pan > Up, but it's only a small amount of movement. Is there a setting accessible by script for setting this amount?
thanks

Comments

  • Kimiko
    edited May 10

    You can choose the option to record or run a script, then select the relevant ".scr" file and edit in a text editor.

    For example I recorded a script to pan up 20 units and this is the code it produced. Once you have recorded it, you can amend the numbers as required. Save and run.

    -PAN
    0,0
    @0,20
    _stopscript

  • Kimiko
    edited May 10

    I read your question again, if you wish to use the -pan command manually to pan a set distance you can do that by entering the start coordinate e.g. " 0,0 [enter]" and the end coordinate e.g. " 0,20 [enter] "

  • Ah, of course - I didn't think to enter co-ordinates for the base point.
    thanks very much

  • Why not type p20 ? Ok that will give give an error message but you can make a little lisp defun that does just that, why not pu20, pd20, pl20, pr20.

    (defun c:p20 (/ )

    (command "pan" "0,0" "0,20")

    )

  • Thanks, this is for part of a larger script. It includes, move selected group up 200, pan up 200, ungroup previously selected, end. This is so I can pull a grouped set of objects out of a larger assembly, work on it, re group it, then reinsert in the previous position.

  • ALANH
    edited May 14

    Easy CHY CHX. Like 1990's

    (defun C:CHX ()
    (SETVAR "CMDECHO" 0)
    (setq sn (getvar "osmode"))
    (command "osnap" "near")
    (setq x 0)
    (princ "\nalters object in X direction")
    (setq ht (getstring "\n What is amount of change: "))
    (setq newht (strcat ht ",0"))
    (while (= x 0)
    (setq newobj (entsel "\nPoint to object: "))
    (if (/= newobj nil)
    (progn
    (command "move" newobj "" "0,0" newht)
    ))
    (if (= newobj nil)(setq x 1))
    )
    )
    ;
    (defun C:CHY ()
    (SETVAR "CMDECHO" 0)
    (setq sn (getvar "osmode"))
    (command "osnap" "near")
    (setq x 0)
    (princ "alters object in Y direction")
    (setq ht (getstring "\n What is amount of change: "))
    (setq newht (strcat "0," ht))
    (while (= x 0)
    (SETQ NEWobj (entsel "\nPoint to object: "))
    (if (/= newobj nil)
    (progn
    (command "move" newobj "" "0,0" newht)
    ))
    (if (= newobj nil)(setq x 1))
    )
    )

    ;simple routine to change objects in the z direction
    (defun C:CHZ ()
    (SETVAR "CMDECHO" 0)
    (setq sn (getvar "osmode"))
    (command "osnap" "near")
    (setq x 0)
    (princ "alters object in Z direction")
    (setq ht (getstring "\n What is amount of change: "))
    (setq newht (strcat "0,0," ht))
    (while (= x 0)
    (SETQ NEWobj (entsel "\nPoint to object: "))
    (if (/= newobj nil)
    (progn
    (command "move" newobj "" "0,0,0" newht)
    ))
    (if (= newobj nil)(setq x 1))
    )
    )

    Ps may not need to ungroup can make anonymous selections (command "MOVE" (ssget) "" p1 p2)

  • Thanks so much - I'll give it a try.