Author Topic: hey what about the little stuff  (Read 8577 times)

0 Members and 1 Guest are viewing this topic.

SKUI_BREAKER

  • Guest
hey what about the little stuff
« on: August 12, 2008, 09:00:08 AM »
i have got a fast copy rotate routine but it needs to be improved
it faulters where every time you paste the object it grabs that objects ucs orientation
it should use the same orientation as the first object that was copied.
but otherwise the lisp is much faster than expresses copy rotate but i know it can be better

Code: [Select]
(DEFUN C:CR (/ pt2 cnt)
  (setq pt2 t)
  (setq crs (ssget))
  (setq pt1 (getpoint "\nBase Point: "))
  (SETVAR "AUTOSNAP" 63)
  (while (/= pt2 nil)
    (setq pt2 (getpoint pt1 "\nTo: "))
    (command "move" crs "" pt1 pt2)
    (command "copy" crs "" pt2 pt1)
    (SETVAR "AUTOSNAP" 63)
    (COMMAND "ROTATE" crs "" pt2 pause)
    (setq pt1 pt2) )
); COPYROT


also what ever happen to exfillet it was not carried over to 2006 or up
does anyone have a soultion to get exfillet back running for the newer autocads

http://discussion.autodesk.com/thread.jspa?threadID=657099
« Last Edit: August 12, 2008, 09:04:02 AM by SKUI_BREAKER »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #1 on: August 12, 2008, 09:30:19 AM »
Here is an old one:
If it doesn't work for you please post a sample DWG to illustrate the failure.
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2005
;;;  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)
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #2 on: August 12, 2008, 10:01:46 AM »
does exactly what i described :-)
but at the cost of not being to see the object before placement :-(

i found another lisp routine but it does not copy rotate multiple i like it though
Code: [Select]
;;;   Mcr.Lsp
;;;   Copyright (C) 1990 by Autodesk Australia Pty. Ltd.
;;; 
;;;   Permission to use, copy, modify, and distribute this software and its
;;;   documentation for any purpose and without fee is hereby granted. 
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
;;;   ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
;;;   MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;;-------------------------------------------------------------------------
;;; DESCRIPTION:
;;;
;;;   Mcr.Lsp provides two new commands, MoveRot and CopyRot.
;;;   MoveRot, MOVEs and ROTATEs selected entities whilst
;;;   CopyRot, COPYies and ROTATEs selected entities.
;;;
;;;   Written by  Sam Crupi, Autodesk Australia Pty. Ltd.
;;;               October 1987
;;;   Modified by Jeff De Silva & Sam Crupi, Autodesk Australia Pty. Ltd.
;;;               November 1990
;;;
;;;   Version 1.0
;;;   4 December 1990
;;;
;;;-------------------------------------------------------------------------
;;;
;;; Error function
;;;
(defun mcr_err (s)                   ; If an error (such as CTRL-C) occurs
                                     ; while this command is active...
  (if (/= s "Function cancelled")
    (if (= s "quit / exit abort")
      (princ)
      (princ (strcat "\nError: " s))
    )
  )
  (if mcr_oer                        ; If an old error routine exists
    (setq *error* mcr_oer)           ; then, reset it
  )
  (if mcr_oce                        ; Reset command echoing on error
    (setvar "cmdecho" mcr_oce)
  )
  (princ)
)
;;;
;;; Command MoveRot
;;;
(defun c:MoveRot (/ sset mcr_oce mcr_oer)
  (setq mcr_oce (getvar "cmdecho"))  ; save cmdecho setting
  (setvar "cmdecho" 0)               ; turn cmdecho off
  (if *error*                        ; Set our new error handler
    (setq mcr_oer *error*
          *error* mcr_err)
    (setq *error* mcr_err)
  )
  (princ (strcat "\nMoveRot, Version " mcr_ver
                 ", (C) 1990 by Autodesk Australia Pty. Ltd. "
         )
  )
  (if (setq sset (ssget))            ; get selection set
    (progn
      (setvar "cmdecho" 1)           ; turn cmdecho on to allow MOVE
                                     ; prompts to appear
      (command "MOVE" sset "" pause pause) ; MOVE them
      ;; now ROTATE the selection set using the LASTPOINT as Base point
      (command "ROTATE" sset "" (getvar "LASTPOINT") pause)
    )
  )
  (setvar "cmdecho" mcr_oce)         ; reset cmdecho to old setting
  (if mcr_oer                        ; If an old error routine exists
     (setq *error* mcr_oer)          ; then set it back
  )
  (princ)
)
;;;
;;; Command CopyRot
;;;
(defun c:CopyRot (/ mcr_oce mcr_oer sset)
  (setq mcr_oce (getvar "cmdecho"))  ; save cmdecho setting
  (setvar "cmdecho" 0)               ; turn cmdecho off
  (if *error*                        ; Set our new error handler
    (setq mcr_oer *error*
          *error* mcr_err)
    (setq *error* mcr_err)
  )
  (princ (strcat "\nCopyRot, Version " mcr_ver
                 ", (C) 1990 by Autodesk Australia Pty. Ltd. "
         )
  )
  (if (setq sset (ssget))            ; get selection set
    (progn
      (command "COPY" sset "" "0,0" "0,0") ; COPY selection set over itself
      (setvar "cmdecho" 1)           ; turn cmdecho on to allow MOVE
                                     ; prompts to appear
      (command "MOVE" "p" "" pause pause)
      (redraw)                       ; Redraw screen
      ;; now ROTATE the selection set using the LASTPOINT as Base point
      (command "ROTATE" "p" "" (getvar "LASTPOINT") pause)
    )
  )
  (setvar "cmdecho" mcr_oce)         ; reset cmdecho to old setting
  (if mcr_oer                        ; If an old error routine exists
     (setq *error* mcr_oer)          ; then set it back
  )
  (princ)
)
;;;
;;; Define the c: functions.
;;;
(defun c:MR ()
  (c:MoveRot)
)
(defun c:CR ()
  (c:CopyRot)
)
(setq mcr_ver "1.0")                 ; set version number string
;;(princ (strcat "\nC:MCR (v" mcr_ver ") loaded."))
;;(princ "\nMR or MoveRot to Move and Rotate, CR or CopyRot to Copy and Rotate.")
(princ)

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #3 on: August 12, 2008, 10:08:02 AM »
how can i get autodesk copyrot to loop over and over until i cancel the command

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #4 on: August 12, 2008, 10:17:15 AM »
the first lisp does everything but copy the first objects selected around instead it copy the ones that were just pasted

the second lisp does what the first lisp wont do except you can't see the object during placement

and the third lisp doesn't copyrot multiple times.

so close but no cigars.


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #5 on: August 12, 2008, 10:49:51 AM »
I revised my version to show the copied objects, but perhaps it would be better to show the original copy.
What are your thoughts?
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2008
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at TheSwamp.org
;;;
;;;   Version 5.0  Aug 12, 2008
;;;
;;; 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
(defun c:copyr (/ pt npt ss elast ssnew ale_lastent ale_ss-after *error*)

  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
            msg
           '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif
    (if (and MoveStarted ssnew)
      (command "._erase" 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 (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
           (setq pt (getpoint "\nPick base point:"))
      )
    (progn
      (command "._copybase" "_non" pt ss "")
      (command "._undo" "_begin")
      (setq elast (ale_lastent))
      (command "._pasteclip" "_non" pt) ; Create a Copy
      (setq ssnew (ale_ss-after elast))
      (while
        (progn
          (setq MoveStarted t)
          (command "._move" ssnew "" "_non" pt pause)
          (if (or (and (null npt) (setq npt (getvar "lastpoint")))
                  (> (distance pt (setq npt (getvar "lastpoint"))) 0.0001))
            (progn
              ;;  allow user to rotate
              (command "._rotate" ssnew "" "_non" npt pause)
              (setq MoveStarted nil)
              (command "._undo" "_end")
              (command "._undo" "_begin")
              ;;  get last item in database
              (setq elast (ale_lastent))
              (command "._pasteclip" "_non" pt)
              ;;  get new items pasted.
              (setq ssnew (ale_ss-after elast))
              t ; stay in loop
            )
          )
        )
      ) ; while
    ) ; progn
  ) ; endif
  (*error* "")
  (command "._undo" "_end")
  (princ)
)
(princ)

<edit: Revised Code>
« Last Edit: August 12, 2008, 11:55:58 AM 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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #6 on: August 12, 2008, 11:23:00 AM »
you got it  :-D

long as you can see what is being copied and where its great.

but one small problem when if you press escape the command leaves the object that was waiting to be placed
its ok if the user presses (spacebar or enter) though

also i think keeping the rhytmn of normal acad function is important
i think you should change the lisp to have the user select the object first then the base point
just like the regular copy/rotate/and move commands do.
select objects
select base point

the cyan arrow points at the object that will be left behind

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #7 on: August 12, 2008, 11:56:24 AM »
I revised the code so try again.

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

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #8 on: August 12, 2008, 01:29:01 PM »
yes that is it this is a must have autocad lisp :-D

i guess you already knew but or saw but on the fillet pline too i posted some stuff about the exfillet no longer being offered in 2006 and up

i read where people tried to copying the exfillet lisp from older version of cad but is still didn't work properly. :-(

you shouldn't thank me for work that you did, i should be the one thanking you.

 thanx so much :lmao:

« Last Edit: August 12, 2008, 01:44:01 PM by SKUI_BREAKER »

Gliderider

  • Guest
Re: hey what about the little stuff
« Reply #9 on: August 12, 2008, 01:46:12 PM »
Very nice CAB, I'll use it a lot. Thanks

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #10 on: August 28, 2008, 11:51:18 AM »
OK I CAN'T TAKE IT ANYMORE I HAVE TO SAY IT  :-(

the lisp is great but there is a big issue when I try using my shift right click commands or ctrl right click commands

my ctrl right click command is "mid point between two points" and if I issue this command while picking the basepoint of the object or placing the object the lisp routine fails

my diagnoses is that when you issue any snap override command wether it be from the keyboard or mouse the lisp will fail. :|

Alan Cullen

  • Guest
Re: hey what about the little stuff
« Reply #11 on: August 28, 2008, 11:59:18 AM »
I haven't read this thread....but I always thought that that acad lisp was P2P.......I'm probably way off the mark......just disregard me........*crawls back to shell*

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #12 on: August 28, 2008, 12:24:33 PM »
Set CMDECHO to 1 & run the lisp to make it fail.
Then post the command line output so I can see what is going on.
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #13 on: September 03, 2008, 12:11:53 PM »
Here is my comm and line
I am trying to use shift-c for snap override of snap to center
Code: [Select]
Command: CMDECHO

Enter new value for CMDECHO <1>:

Command: CR

Select objects to copy:
Select objects: Specify opposite corner: 7 found

Select objects:

Pick base point:._copybase Specify base point: _non
Invalid point.
Specify base point:
Select objects: Specify opposite corner: 6 found

Select objects: 1 found, 7 total

Select objects:

Command: CR

Select objects to copy:
Select objects: Specify opposite corner: 7 found

Select objects:

Pick base point: <Polar on>  <Object Snap Tracking on> ._copybase Specify base
point: _non
Select objects:   7 found

Select objects:
Command: ._undo Current settings: Auto = On, Control = All, Combine = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back]
<1>: _begin
Command: ._pasteclip Duplicate definition of block _Open90  ignored.
Duplicate definition of block _Small  ignored.
Duplicate definition of block AecRight  ignored.
Duplicate definition of block _Oblique  ignored.
Specify insertion point: _non
Command: ._move
Select objects:   7 found

Select objects:
Specify base point or [Displacement] <Displacement>: _non Specify second point
or <use first point as displacement>:
>>Enter new value for ORTHOMODE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>: *Cancel*

Command: ._erase
Select objects:   7 found

Select objects:
Command:
Command: CR

Select objects to copy:
Select objects: Specify opposite corner: 7 found

Select objects:

Pick base point:._copybase Specify base point: _non
Select objects:   7 found

Select objects:
Command: ._undo Current settings: Auto = On, Control = All, Combine = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back]
<1>: _begin
Command: ._pasteclip Duplicate definition of block _Open90  ignored.
Duplicate definition of block _Small  ignored.
Duplicate definition of block AecRight  ignored.
Duplicate definition of block _Oblique  ignored.
Specify insertion point: _non
Command: ._move
Select objects:   7 found

Select objects:
Specify base point or [Displacement] <Displacement>: _non Specify second point
or <use first point as displacement>:
>>Enter new value for OSMODE <4351>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSNAPOVERRIDE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSMODE <4351>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSNAPOVERRIDE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSMODE <4351>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSNAPOVERRIDE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
Command: ._rotate
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0

Select objects:   7 found

Select objects:
Specify base point: _non
Invalid point.

Specify base point: ._erase
Invalid point.
; error: An error has occurred inside the *error* functionFunction cancelled

Specify base point:
Specify rotation angle or [Copy/Reference] <270>:

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #14 on: September 03, 2008, 12:13:44 PM »
these pictures above show step by step of trying to pick the base point with a snap override

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #15 on: September 03, 2008, 12:16:37 PM »
these pictures above show the results of picking a base point while use a snap override.

And the pictures below show the result of trying to place an object while using a snap override.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #16 on: September 03, 2008, 04:19:24 PM »
Give this a test run:
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2008
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at TheSwamp.org
;;;
;;;   Version 5.1  Sep 03, 2008
;;;
;;; 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
(defun c:copyr (/ pt npt ss elast ssnew ale_lastent ale_ss-after *error*)

  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
            msg
           '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif
    (and usrosmode (setvar "osmode" usrosmode))
    (if (and MoveStarted ssnew)
      (command "._erase" 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
      )
    )
  )
  (setq usrosmode (getvar "osmode"))
  (if (and (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
           (setq pt (getpoint "\nPick base point:"))
      )
    (progn
      (setvar "osmode" 0)
      (command "._copybase" pt ss "")
      (command "._undo" "_begin")
      (setq elast (ale_lastent))
      (setvar "osmode" 0)
      (command "._pasteclip" pt) ; Create a Copy
      (setq ssnew (ale_ss-after elast))
      (while
        (progn
          (setq MoveStarted t)
  (setvar "osmode" 0)
          (command "._move" ssnew ""  pt pause)
          (if (or (and (null npt) (setq npt (getvar "lastpoint")))
                  (> (distance pt (setq npt (getvar "lastpoint"))) 0.0001))
            (progn
              ;;  allow user to rotate
              (command "._rotate" ssnew "" npt pause)
              (setq MoveStarted nil)
              (command "._undo" "_end")
              (command "._undo" "_begin")
              ;;  get last item in database
              (setq elast (ale_lastent))
      (setvar "osmode" 0)
              (command "._pasteclip" pt)
              ;;  get new items pasted.
              (setq ssnew (ale_ss-after elast))
              t ; stay in loop
            )
          )
        )
      ) ; while
    ) ; progn
  ) ; endif
  (*error* "")
  (command "._undo" "_end")
  (princ)
)
(princ)
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #17 on: September 03, 2008, 05:27:32 PM »
test #1 : the lisp still acts up when trying to select the base point with snap override
the lisp has improved when placing the object using overrides although after the object is placed
and i am ready to copy rotate again, my snap settings have been disabled


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #18 on: September 03, 2008, 08:59:52 PM »
I'll update the code tomorrow to restore the osnaps but what is the glitch with the Copy base point?
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #19 on: September 04, 2008, 07:27:04 AM »
step 1 is to select objects to be copied
step 2 is to select the base point for which the objects will move from    ( this is where the snap override screws it up at)
step 3 is to pick the new base point of the objects
step 4 is to rotate the objects that have been copied             
step 5 starts over from step 3                                 ( this is where the snap settings is getting shut off)

to be honest i was messing with my cr the simple one and some how i got it working yesterday but i used visual lisp editor one of the few times i did and i saved it at as an ls and did something where i lost the lsp file and i am so pissed at my self.
i think that the simplest routine will be the fastest. this is what i got so far i just can't get it to copy the first item i selected it keeps copying the previous one. i figured out the base point thing.  i was thinking i will try to get the lisp to get "crs"  then assign "crs" to "crt"  so that "crt" can be assigned back to "crs" after it has been copied and rotated" but am unsure how to do it.

Code: [Select]
(DEFUN C:CR (/ pt2 cnt crt crs pt3 pt1)
  (setq pt2 t)
  (setq crs (ssget))
   (setq pt1 (getpoint "\nBase Point: "))
  (SETVAR "AUTOSNAP" 63)
  (setq pt3 pt1)
  (while (/= pt2 nil) (setq crs CRT)
    (setq pt2 (getpoint pt1 "\nTo: "))
(command "MOVE" crs "" pt1 pt2)
(command "copy" crS "" pt2 pt1)
(setq crT CRS)
    (SETVAR "AUTOSNAP" 63)
    (COMMAND "ROTATE" crS "" pt2 pause)
    (setq pt1 pt3) (setq crs CRt)
     
)
); COPYROT

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #20 on: September 04, 2008, 09:02:38 AM »
Try this update.
Note that .ls is a backup file type. When you save, the file type will be .lsp and you don't have to enter that!
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2008
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at TheSwamp.org
;;;
;;;   Version 5.2  Sep 04, 2008
;;;
;;; 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
(defun c:copyr (/ pt npt ss elast ssnew ale_lastent ale_ss-after *error*
                MoveStarted osmodetmp usrosmode)

  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
            msg
           '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif
    (and usrosmode (setvar "osmode" usrosmode))
    (if (and MoveStarted ssnew)
      (command "._erase" 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
      )
    )
  )
  (setq usrosmode (getvar "osmode"))
  (setq osmodetmp (getvar "osmode"))
  (if (and (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
           (setq pt (getpoint "\nPick base point:"))
      )
    (progn
      (setvar "osmode" 0)
      (command "._copybase" pt ss "")
      (command "._undo" "_begin")
      (setq elast (ale_lastent))
      (command "._pasteclip" pt) ; Create a Copy
      (setq ssnew (ale_ss-after elast))
      (while
        (progn
          (setq MoveStarted t)
  (setvar "osmode" 0)
          (command "._move" ssnew ""  pt)
          (setvar "osmode" osmodetmp)
          (command pause)
          (if (or (and (null npt) (setq npt (getvar "lastpoint")))
                  (> (distance pt (setq npt (getvar "lastpoint"))) 0.0001))
            (progn
              ;;  allow user to rotate
              (setvar "osmode" 0)
              (command "._rotate" ssnew "" npt)
              (setvar "osmode" osmodetmp)
              (command pause)
              (setq MoveStarted nil)
              (command "._undo" "_end")
              (command "._undo" "_begin")
              ;;  get last item in database
              (setq elast (ale_lastent))
      (setvar "osmode" 0)
              (command "._pasteclip" pt)
              ;;  get new items pasted.
              (setq ssnew (ale_ss-after elast))
              t ; stay in loop
            )
          )
        )
      ) ; while
    ) ; progn
  ) ; endif
  (*error* "")
  (command "._undo" "_end")
  (princ)
)
(princ)
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #21 on: September 04, 2008, 09:17:02 AM »
negative

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #22 on: September 04, 2008, 09:56:55 AM »
I'm testing on ACAD2006 & works for me.

I start with my usual Osnap settings & when asked to pick the Base Point for the Copy & press & hold [shift c]
This activates the Center Snap when hovering near the circle. Left click gets me the correct pick point.

What is happening for you?
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #23 on: September 04, 2008, 10:11:19 AM »
it says invalid point when i try to pick it with snap override

( before objects are copied see above)
and on the other end of the lisp (assuming i pick the basepoint correctly)
(after objects are copied see below)

 it makes me pick the basepoint again when i place the object with snap override


Code: [Select]
Command: copyr

Select objects to copy:
Select objects: Specify opposite corner: 3 found

Select objects:

Pick base point:._copybase Specify base point:
Invalid point.
Specify base point:
Select objects: Specify opposite corner: 3 found

Select objects:

Command: c*Cancel*

Command: copyr

Select objects to copy:
Select objects: Specify opposite corner: 3 found

Select objects:

Pick base point:._copybase Specify base point:
Select objects:   3 found

Select objects:
Command: ._undo Current settings: Auto = On, Control = All, Combine = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back]
<1>: _begin
Command: ._pasteclip Specify insertion point:
Command: ._move
Select objects:   3 found

Select objects:
Specify base point or [Displacement] <Displacement>: Specify second point or
<use first point as displacement>:
>>Enter new value for ORTHOMODE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSMODE <4607>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
>>Enter new value for OSNAPOVERRIDE <0>:
Resuming .MOVE command.
Specify second point or <use first point as displacement>:
Command: ._rotate
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0

Select objects:   3 found

Select objects:
Specify base point:
Invalid point.

Specify base point: ._erase
Invalid point.
; error: An error has occurred inside the *error* functionFunction cancelled

Specify base point:
Specify rotation angle or [Copy/Reference] <0>:

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #24 on: September 04, 2008, 10:14:39 AM »
oh and technially speaking you shouldn't have to be near the center of the circle for the osnap override to work
you should be able to hover around the edge of it too. long as the aperature box is over part of the circle.

gosh i hope this doesn't sound rude.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #25 on: September 04, 2008, 10:25:43 AM »
this lisp would be exactly what i wanted if i didn't have to settle for it copying around only the (last object)
because obvisouly the last object is only going to be only one object and not all of the objects.

its perfect if you don't have to copyrotate multiple objects


Code: [Select]
(DEFUN C:CopyR (/ pt2 cnt)
  (setq pt2 t)
  (setq crs (ssget))
   (setq pt1 (getpoint "\nBase Point: "))
  (setq pt3 PT1)
  (SETVAR "AUTOSNAP" 63)
  (while (/= pt2 nil)
    (setq pt2 (getpoint pt1 "\nTo: "))
     (command "move" crs "" pt1 pt2)
    (setq crs "p")
    (command "copy" crs "" pt2 pt1)
     (SETVAR "AUTOSNAP" 63)
    (COMMAND "ROTATE" crs  "" pt2 pause)
        (setq crs "last")  )
); COPYROT

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: hey what about the little stuff
« Reply #26 on: September 04, 2008, 10:50:55 AM »
Another Stab:
Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2008
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at TheSwamp.org
;;;
;;;   Version 5.2a  Sep 04, 2008
;;;
;;; 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
(defun c:copyr (/ pt npt ss elast ssnew ale_lastent ale_ss-after *error*
                MoveStarted osmodetmp usrosmode)

  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
            msg
           '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif
    (and usrosmode (setvar "osmode" usrosmode))
    (if (and MoveStarted ssnew)
      (command "._erase" 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
      )
    )
  )
  (setq usrosmode (getvar "osmode"))
  (setq osmodetmp (getvar "osmode"))
  (if (and (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
           (setq pt (getpoint "\nPick base point:"))
      )
    (progn
      (setvar "osmode" 0)
      (command "._copybase" pt ss "")
      (command "._undo" "_begin")
      (setq elast (ale_lastent))
      (command "._pasteclip" pt) ; Create a Copy
      (setq ssnew (ale_ss-after elast))
      (while
        (progn
          (setq MoveStarted t)
          (setvar "osmode" osmodetmp)
          (setq npt (getpoint pt "\nTo: ")) ; new
  (setvar "osmode" 0)
          (command "._move" ssnew ""  pt npt)
          (if (and npt
                  (> (distance pt (setq npt (getvar "lastpoint"))) 0.0001))
            (progn
              ;;  allow user to rotate
              (setvar "osmode" osmodetmp)
              (command "._rotate" ssnew "" npt pause)
              (setq MoveStarted nil)
              (command "._undo" "_end")
              (command "._undo" "_begin")
              ;;  get last item in database
              (setq elast (ale_lastent))
      (setvar "osmode" 0)
              (command "._pasteclip" pt)
              ;;  get new items pasted.
              (setq ssnew (ale_ss-after elast))
              t ; stay in loop
            )
          )
        )
      ) ; while
    ) ; progn
  ) ; endif
  (*error* "")
  (command "._undo" "_end")
  (princ)
)
(princ)
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.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #27 on: September 04, 2008, 11:08:36 AM »
WHOA!!!!!!!!!!! WHAT LUCk

see if this works for you because it is working for me!!!         awesome  just a few mod's

Code: [Select]
;;;  CopyRotate.lsp by Charles Alan Butler
;;;         Copyright 2008
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at TheSwamp.org
;;;
;;;   Version 5.2a  Sep 04, 2008
;;;
;;; 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
(defun c:CR (/ pt npt ss elast ssnew ale_lastent ale_ss-after *error*
                MoveStarted osmodetmp usrosmode)

  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
            msg
           '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif
    (and usrosmode (setvar "osmode" usrosmode))
    (if (and MoveStarted ssnew)
      (command "._erase" 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 (null (prompt "\nSelect objects to copy:"))
           (setq ss (ssget))
           (setq pt (getpoint "\nPick base point:"))
      )
    (progn
      (command "._copybase" pt ss "")
      (command "._undo" "_begin")
      (setq elast (ale_lastent))
      (command "._pasteclip" pt) ; Create a Copy
      (setq ssnew (ale_ss-after elast))
      (while
        (progn
          (setq MoveStarted t)
             (setq npt (getpoint pt "\nTo: ")) ; new
           (command "._move" ssnew ""  pt npt)
          (if (and npt
                  (> (distance pt (setq npt (getvar "lastpoint"))) 0.0001))
            (progn
              ;;  allow user to rotate
             
              (command "._rotate" ssnew "" npt pause)
              (setq MoveStarted nil)
              (command "._undo" "_end")
              (command "._undo" "_begin")
              ;;  get last item in database
              (setq elast (ale_lastent))
        (command "._pasteclip" pt)
              ;;  get new items pasted.
              (setq ssnew (ale_ss-after elast))
              t ; stay in loop
            )
          )
        )
      ) ; while
    ) ; progn
  ) ; endif
  (*error* "")
  (command "._undo" "_end")
  (princ)
)
(princ)

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #28 on: September 04, 2008, 11:14:37 AM »
crap i opened up a new dwg and its not working....

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #29 on: September 04, 2008, 11:30:03 AM »
ok now i don't know what to say i took everything out of my startup contents and started a new version of acad and when i got to the new drawing there was a cr=copyrotate command already in acad as though it was built-in it doesn't do multiple times though,

and so i load your app with the mod's i had made and the lisp cr command started working perfectly. i don't understand why that is.

SKUI_BREAKER

  • Guest
Re: hey what about the little stuff
« Reply #30 on: September 04, 2008, 11:50:17 AM »
ok now i realize its being picking at what it will allow and i am going to upload a drwing that has objects it doesn't like see if anyone else get the same results