Added moveOrigin and deleteLayouts
This commit is contained in:
51
source scripts/moveOrigin.lsp
Normal file
51
source scripts/moveOrigin.lsp
Normal file
@@ -0,0 +1,51 @@
|
||||
(defun C:moveOrigin (/ move wcs setCurrUcs newOrigin)
|
||||
(vl-load-com)
|
||||
(graphscr)
|
||||
|
||||
(initget 1 "Yes No")
|
||||
(setq move (getkword "Move origin? [Yes/No]"))
|
||||
(if
|
||||
(= move "Yes")
|
||||
(progn
|
||||
(setq wcs (getvar "worlducs"))
|
||||
(if
|
||||
(= wcs 0)
|
||||
(progn
|
||||
;; it's not WCS
|
||||
(initget 1 "UCS Pick")
|
||||
(setq setCurrUcs (getkword "Set current UCS or pick point [UCS/Pick]"))
|
||||
(if
|
||||
(= setCurrUcs "UCS")
|
||||
(progn
|
||||
(setq newOrigin (trans '(0.0 0.0 0.0) 1 0))
|
||||
(command "._UCS" "W")
|
||||
(moveDrawing newOrigin)
|
||||
)
|
||||
(progn
|
||||
;; Pick point selected
|
||||
(command "._UCS" "W")
|
||||
(pickPoint)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
;;it's wcs:
|
||||
(pickPoint)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun pickPoint ()
|
||||
(setq newOrigin (getpoint "\nPick new origin"))
|
||||
;; (print newOrigin)
|
||||
(moveDrawing newOrigin)
|
||||
)
|
||||
|
||||
(defun moveDrawing (point / ssX coords)
|
||||
(setq ssX (ssget "x"))
|
||||
(setq coords (strcat (rtos (car point) 2) "," (rtos (cadr point) 2)))
|
||||
|
||||
(command "move" ssX "" coords "0,0")
|
||||
)
|
||||
Reference in New Issue
Block a user