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

0 Members and 1 Guest are viewing this topic.

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.