Author Topic: hey what about the little stuff  (Read 8589 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