Author Topic: copy and rotate combined  (Read 9862 times)

0 Members and 1 Guest are viewing this topic.

M-dub

  • Guest
copy and rotate combined
« Reply #15 on: August 11, 2004, 01:45:56 PM »
Cheers!
I'm glad I posted it.

daron

  • Guest
copy and rotate combined
« Reply #16 on: August 11, 2004, 02:39:04 PM »
Mark, that looks like a nice routine. I like the way you released your objects.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
copy and rotate combined
« Reply #17 on: August 11, 2004, 02:39:54 PM »
Thanks Daron but it has some limitations
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
copy and rotate combined
« Reply #18 on: August 12, 2004, 09:43:19 AM »
thanks guys mdub you are the winner works great for me presh

M-dub

  • Guest
copy and rotate combined
« Reply #19 on: August 12, 2004, 10:34:48 AM »
Hey, I didn't write it...I just posted it.  ;)

ELOQUINTET

  • Guest
copy and rotate combined
« Reply #20 on: August 12, 2004, 10:41:04 AM »
yeah i know ya thief  :P

Serge J. Gianolla

  • Guest
copy and rotate combined
« Reply #21 on: August 13, 2004, 08:24:56 PM »
Isn't Copy and Rotate another way to say Array Polar :o :lol:

ELOQUINTET

  • Guest
copy and rotate combined
« Reply #22 on: August 13, 2004, 10:25:37 PM »
yeah the same as hurricane too

Serge J. Gianolla

  • Guest
copy and rotate combined
« Reply #23 on: August 14, 2004, 12:00:38 AM »
I am afraid that a hurricane is only Move/rotate, it does not create duplicates :twisted:

ELOQUINTET

  • Guest
copy and rotate combined
« Reply #24 on: August 14, 2004, 10:37:16 AM »
all great things have duplicates, tropical storms are always tryin to be hurricanes

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
copy and rotate combined
« Reply #25 on: August 16, 2004, 12:11:10 PM »
Here is another version of Copy/Rotate:
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at ab2draft[at]TampaBay.rr.com
;;;
;;;   Version 4.0 Beta  Feb 07,2005
;;;
;;; DESCRIPTION
;;; User pick base point then selects object(s)
;;; Paste mode until Escape is pressed
;;; Once pasted user selects rotation angle
;;;
;;; Command Line Usage
;;; Command: copyr
;;  Copy objects, then paste & rotate new copy
;;  does not show the objects during paste
(defun c:copyr (/ pt ss elast ssnew)
         
  ;; Rune Wold and Michael Puckett - modified ale_lastent ale_ss-after
  (defun ale_lastent (/ entnam outval)
    (and
      (setq outval (entlast))
      (while (setq entnam (entnext outval))
        (setq outval entnam)
      )
    )
    outval
  )

  (defun ale_ss-after (entnam / entnxt selset)
    (cond
      ((not entnam) (ssget "_X"))
      ((setq entnxt (entnext entnam))
       (setq selset (ssadd entnxt))
       (while (setq entnxt (entnext entnxt))
         (if (entget entnxt)
           (ssadd entnxt selset)
         )
       )
       selset
      )
    )
  )
  (if (and (setq pt (getpoint "\nPick base point of object to copy:"))
           (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
      )
    (progn
      (command "._copybase" pt ss "")
      (while (setq pt (getpoint "\nPick insertion point."))
        ;;  get last item in database
        (setq elast (ale_lastent))
        (command "._pasteclip" pt)
        ;;  get new items pasted.
        (setq ssnew (ale_ss-after elast))
        ;;  allow user to rotate
        (command "._rotate" ssnew "" pt pause)
      ) ; while
    ) ; progn
  ) ; endif
  (princ)
)
(princ)

<edit: code updated>
« Last Edit: February 27, 2007, 03:31:14 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Crank

  • Water Moccasin
  • Posts: 1503
copy and rotate combined
« Reply #26 on: August 19, 2004, 02:41:41 PM »
I'm using my own code:
Code: [Select]

(defun c:movrot  () (b-cmr "M")(princ))
(defun c:coprot  () (b-cmr "C")(princ))
;***************************************************************************
; File   : mcr.lsp
; Date   : 20-9-03
; Function  : (B-CMR <MODE>)
; Purpose : Copy+Rotate or Move+Rotate
; Arguments : <MODE> = "C" -> Copy-rotate
;              = "M" -> Move-rotate
; Written by : J.J.Damstra
;***************************************************************************
(defun b-cmr (typ / ss1 temp p0 p1)
(setq ss1 (ssget "I"))

(command ".undo" "begin")
(setq temp (getvar "CMDECHO"))(setvar "CMDECHO" 0)

(if (not ss1)(setq ss1 (ssget)))
(if ss1
(progn
(initget 1)
(setq p0 (getpoint "\nBasepoint : "))

(if (= typ "C")
(progn
(setq p1 (getpoint "\nTranslation or <ENTER>: " p0))
(if (not p1)(setq p1 p0))
(command ".copy" ss1 "" "0,0" "0,0")
)
(while (not p1)(setq p1 (getpoint "\nTranslation : " p0)))
)

(command ".move" ss1 "" p0 p1)
(command ".rotate" ss1 "" p1 pause)
)
(princ "\nMsg> Nothing selected! ")
)

(command ".undo" "end")
(setvar "CMDECHO" temp)
(princ)
)

All examples in this topic have a minor bug: The translation is performed with the selected objects, but the selected objects shouldn't be moved!
If you now use PREVIOUS to make a selection in the next command you don't get what expect, but the 'new' objects.

In my example after the COPY-command you should make a new selection with the new objects.
Vault Professional 2023     +     AEC Collection

M-dub

  • Guest
copy and rotate combined
« Reply #27 on: August 19, 2004, 02:51:39 PM »
Thanks a lot for posting that one, Crack.
I think I'm going to replace the routines I was using with this one.

Welcome to TheSwamp!

ELOQUINTET

  • Guest
copy and rotate combined
« Reply #28 on: August 19, 2004, 03:58:31 PM »
yeah i like that one better too the other one made a group of the copied entities which took forever to regen and not what i want. anyway thanks crack