Author Topic: Copy and rotate (kopieren und drehen)  (Read 25587 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Copy and rotate (kopieren und drehen)
« Reply #15 on: January 05, 2012, 03:14:37 PM »
Nice usage of acet-ss-drag-rotate, Alan. :beer:

I really need to go over the acet* functions again. LoL
:)
There's also acet-ss-drag-scale.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: Copy and rotate (kopieren und drehen)
« Reply #16 on: January 05, 2012, 03:20:50 PM »
For those who are interested:

acet-ss-drag-move
Quote

(acet-ss-drag-move ss pt [prompt] [highlight [cursor]])

Drag a selection set to change location.

Arguments
ss: The selection set to drag.
pt: The base point.
prompt: A message to display before dragging is started.
highlight: If given, causes a rubber-band line to be drawn from pt to the current cursor position while dragging; this parameter can be nil to draw a rubber-band line in the inverse of the screen color, or non-nil to draw a highlighted line.
cursor: The cursor form to display while dragging (0=crosshairs, 1=no cursor, 2=target).

Return Values
Normally returns the selected point, but will honor initget settings and can return arbitrary text or keywords. Returns nil if the dragging operation is aborted.

Note:
The acet-ss-drag-move function does not move the selection set, but allows selection of a new position while showing how the result will appear.

acet-ss-drag-rotate
Quote

(acet-ss-drag-rotate ss pt [prompt] [highlight [cursor]])

Drag a selection set to change rotation.

Arguments
ss: The selection set to drag.
pt: The base point.
prompt: A message to display before dragging is started.
highlight: If given, causes a rubber-band line to be drawn from pt to the current cursor position while dragging; this parameter can be nil to draw a rubber-band line in the inverse of the screen color, or non-nil to draw a highlighted line.
cursor: Gives the cursor form to display while dragging (0=crosshairs, 1=no cursor, 2=target).

Return Values
The selected rotation value, or nil if dragging is aborted.

Note:
The acet-ss-drag-rotate function does not rotate the selection set, but allows selection of a rotation value while showing how the result will appear.

acet-ss-drag-scale
Quote

(acet-ss-drag-scale ss pt [prompt] [highlight [cursor]])

Drag a selection set to change scale.

Arguments
ss: The selection set to drag.
pt: The base point.
prompt: A message to display before dragging is started.
highlight: If given, causes a rubber-band line to be drawn from pt to the current cursor position while dragging; this parameter can be nil to draw a rubber-band line in the inverse of the screen color, or non-nil to draw a highlighted line.
cursor: Gives the cursor form to display while dragging (0=crosshairs, 1=no cursor, 2=target).

Return Values
The selected scale factor, or nil if dragging is aborted.

Note:
The acet-ss-drag-scale function does not scale the selection set, but allows selection of a scaling factor while showing how the result will appear.
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Copy and rotate (kopieren und drehen)
« Reply #17 on: January 05, 2012, 03:25:01 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: Copy and rotate (kopieren und drehen)
« Reply #18 on: January 05, 2012, 03:25:49 PM »


LoL - That's where I got those from, silly.  :lol:

Edit - I wasn't sure if you'd mind my sharing the doc, so I posted the discussed functions only.
"How we think determines what we do, and what we do determines what we get."

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Copy and rotate (kopieren und drehen)
« Reply #19 on: January 05, 2012, 03:31:09 PM »


LoL - That's where I got those from, silly.  :lol:

Edit - I wasn't sure if you'd mind my sharing the doc, so I posted the discussed functions only.
Oops.
I didn't write the doc - found online when I started LISP'n.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: Copy and rotate (kopieren und drehen)
« Reply #20 on: January 05, 2012, 04:24:28 PM »


LoL - That's where I got those from, silly.  :lol:

Edit - I wasn't sure if you'd mind my sharing the doc, so I posted the discussed functions only.
Oops.
I didn't write the doc - found online when I started LISP'n.
:lmao:
"How we think determines what we do, and what we do determines what we get."

Hugo

  • Bull Frog
  • Posts: 430
Re: Copy and rotate (kopieren und drehen)
« Reply #21 on: January 06, 2012, 05:04:16 AM »
@ Lee

Have the Lisp CHANGED to accurately align the objects again.
Is this ok Sun
Thank you

Habe das Lisp geänder um die Objekte nochmal genau auszurichten.
Ist das ok so.
Danke

Code: [Select]
(defun c:cr ( / c s )
    (if (setq c (getvar 'COPYMODE)) (setvar 'COPYMODE 1))
    (if (setq s (ssget "_:L"))
        (command
            "_.copy"   s "" "_non" '(0 0 0) "_non" "@"
            "_.move"   s "" pause pause
            "_.rotate" s "" "_non" (getvar 'LASTPOINT) pause
            "_.move"   s "" (getvar 'LASTPOINT)
        )
    )
    (if c (setvar 'COPYMODE c))
    (princ)
)

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Copy and rotate (kopieren und drehen)
« Reply #22 on: January 06, 2012, 06:51:22 AM »
Sorry Hugo, I'm not sure that I understand?

Hugo

  • Bull Frog
  • Posts: 430
Re: Copy and rotate (kopieren und drehen)
« Reply #23 on: January 06, 2012, 07:37:04 AM »
I've added the move
is it ok

ich habe Schieben hinzugefügt
ist das ok

Hugo

  • Bull Frog
  • Posts: 430
Re: Copy and rotate (kopieren und drehen)
« Reply #24 on: January 08, 2012, 04:21:41 AM »
Thanks to all   :-)

Danke an alle

ribarm

  • Gator
  • Posts: 3272
  • Marko Ribar, architect
Re: Copy and rotate (kopieren und drehen)
« Reply #25 on: September 19, 2012, 04:00:03 AM »
Hugo, you were probably looking for this to imitate MOCORO - faster solution :

Code: [Select]
(defun c:cr ( / *error* c s )
  (defun *error* (msg)
    (if c (setvar 'COPYMODE c))
    (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
      (princ (strcat "\nError: " msg))
    )
  )
  (if (setq c (getvar 'COPYMODE)) (setvar 'COPYMODE 1))
  (defun cr nil
    (if (not (eq s nil))
      (progn
        (command
            "_.copy"   s "" "_non" '(0 0 0) "_non" "@"
            "_.move"   s "" pause pause
            "_.rotate" s "" "_non" (getvar 'LASTPOINT) pause
            "_.move"   s "" (getvar 'LASTPOINT) pause
        )
        (cr)
      )
      (progn
        (setq s (ssget "_:L"))
        (command
            "_.copy"   s "" "_non" '(0 0 0) "_non" "@"
            "_.move"   s "" pause pause
            "_.rotate" s "" "_non" (getvar 'LASTPOINT) pause
            "_.move"   s "" (getvar 'LASTPOINT) pause
        )
        (cr)
      )
    )
  )
  (cr)
  (*error* nil)
  (princ)
)

(defun c:mr ( / s )
  (defun mr nil
    (if (not (eq s nil))
      (progn
        (command
            "_.move"   s "" pause pause
            "_.rotate" s "" "_non" (getvar 'LASTPOINT) pause
        )
        (mr)
      )
      (progn
        (setq s (ssget "_:L"))
        (command
            "_.move"   s "" pause pause
            "_.rotate" s "" "_non" (getvar 'LASTPOINT) pause
        )
        (mr)
      )
    )
  )
  (mr)
  (princ)
)

M.R.
« Last Edit: September 19, 2012, 04:57:53 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Hugo

  • Bull Frog
  • Posts: 430
Re: Copy and rotate (kopieren und drehen)
« Reply #26 on: September 19, 2012, 04:26:23 AM »
super Thanks    :-)

super Danke

ribarm

  • Gator
  • Posts: 3272
  • Marko Ribar, architect
Re: Copy and rotate (kopieren und drehen)
« Reply #27 on: September 19, 2012, 05:07:25 AM »
You're welcome Hugo, just added error handler, because of sysvar COPYMODE... Now it should work correct - to finish press ESC - terminate routine...

M.R. :-)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Hugo

  • Bull Frog
  • Posts: 430
Re: Copy and rotate (kopieren und drehen)
« Reply #28 on: September 19, 2012, 07:03:32 AM »
Danke  :-) :-)

ribarm

  • Gator
  • Posts: 3272
  • Marko Ribar, architect
Re: Copy and rotate (kopieren und drehen)
« Reply #29 on: September 21, 2012, 04:41:59 AM »
Modified further more - maybe this version is more adequate - we don't know if we want copy, move or rotate, so I leaved all options open - only thing is that you have to do things with keyboard also... I couldn't think anything better than this - it uses grread :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:mcr ( / *error* c cmde s )
  2.   (defun *error* (msg)
  3.     (if c (setvar 'COPYMODE c))
  4.     (if cmde (setvar 'CMDECHO cmde))
  5.     (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
  6.       (princ (strcat "\nError: " msg))
  7.     )
  8.   )
  9.   (if (setq cmde (getvar 'CMDECHO)) (setvar 'CMDECHO 0))
  10.   (if (setq c (getvar 'COPYMODE)) (setvar 'COPYMODE 1))
  11.   (defun do_C nil
  12.     (prompt "\nNext point : ")
  13.     (command "_.point" "_non" "@")
  14.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  15.     (entdel (entlast))
  16.     (command "_.undo" "m")
  17.     (command "_.copy" s "" "_non" (getvar 'LASTPOINT) "_non" (getvar 'LASTPOINT))
  18.     (command "_.move" s "" "_non" (if llp (setq lp llp) (setq lp (getvar 'LASTPOINT))) pause)
  19.     (setq lllp (mapcar '- (setq llp (getvar 'LASTPOINT)) lp))
  20.   )
  21.   (defun do_CC nil
  22.     (command "_.point" "_non" "@")
  23.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  24.     (entdel (entlast))
  25.     (command "_.undo" "m")
  26.     (command "_.copy" s "" "_non" (getvar 'LASTPOINT) "_non" (getvar 'LASTPOINT))
  27.     (command "_.move" s "" "_non" (if llp llp (setq lp (getvar 'LASTPOINT))) "_non" (if llp (setq llp (mapcar '+ llp lllp)) lp))
  28.   )
  29.   (defun do_CCC ( / n k kk pt )
  30.     (command "_.point" "_non" "@")
  31.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  32.     (entdel (entlast))
  33.     (command "_.undo" "m")
  34.     (initget 7)
  35.     (setq n (getint "\nEnter number of array items - (spaces - 1) : "))
  36.     (command "_.copy" s "" "_non" (getvar 'LASTPOINT) "_non" (getvar 'LASTPOINT))
  37.     (command "_.move" s "" "_non" (if llp (setq lp llp) (setq lp (getvar 'LASTPOINT))) pause)
  38.     (setq lllp (mapcar '- (setq llp (getvar 'LASTPOINT)) lp))
  39.     (setq k (float (+ n 1)))
  40.     (setq kk 0.0)
  41.     (repeat n
  42.       (setq pt (mapcar '- lp (mapcar '* (list (* (setq kk (1+ kk)) (/ 1.0 k)) (* kk (/ 1.0 k)) (* kk (/ 1.0 k))) lllp)))
  43.       (command "_.copy" s "" "_non" lp "_non" pt)
  44.     )
  45.     (setvar 'LASTPOINT llp)
  46.   )
  47.   (defun do_M nil
  48.     (prompt "\nNext point : ")
  49.     (command "_.point" "_non" "@")
  50.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  51.     (entdel (entlast))
  52.     (command "_.undo" "m")
  53.     (command "_.move" s "" "_non" (if llp (setq lp llp) (setq lp (getvar 'LASTPOINT))) pause)
  54.     (setq lllp (mapcar '- (setq llp (getvar 'LASTPOINT)) lp))
  55.   )
  56.   (defun do_MM nil
  57.     (command "_.point" "_non" "@")
  58.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  59.     (entdel (entlast))
  60.     (command "_.undo" "m")
  61.     (command "_.move" s "" "_non" (if llp llp (setq lp (getvar 'LASTPOINT))) "_non" (if llp (setq llp (mapcar '+ llp lllp)) lp))
  62.     )
  63.   (defun do_R nil
  64.     (prompt "\nAngle in decimal degrees : ")
  65.     (command "_.point" "_non" "@")
  66.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  67.     (entdel (entlast))
  68.     (command "_.undo" "m")
  69.     (command "_.rotate" s "" "_non" (if llp llp (getvar 'LASTPOINT)) pause)
  70.   )
  71.   (defun do_RT nil
  72.     (command "_.point" "_non" "@")
  73.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  74.     (entdel (entlast))
  75.     (command "_.undo" "m")
  76.     (command "_.rotate" s "" "_non" (if llp llp (getvar 'LASTPOINT)) 90)
  77.   )
  78.   (defun do_RR nil
  79.     (command "_.point" "_non" "@")
  80.     (setq l (cons (trans (cdr (assoc 10 (entget (entlast)))) 0 1) l))
  81.     (entdel (entlast))
  82.     (command "_.undo" "m")
  83.     (command "_.rotate" s "" "_non" (if llp llp (getvar 'LASTPOINT)) "")
  84.   )
  85.   (defun do_U nil
  86.     (command "_.undo" "b")
  87.     (setq llp (car l))
  88.     (setvar 'LASTPOINT llp)
  89.     (setq l (cdr l))
  90.   )
  91.   (defun mcr ( / loop gr l p lp llp lllp )
  92.     (setq loop T)
  93.     (if (not (eq s nil))
  94.       (while loop
  95.         (prompt "\n\"S\" key for new selection and basepoint; \"P\" key for base point; \t\"C\" key for copy; \"A\" key for copy-array; \"D\" key for copy-continuous; \"M\" key for move; \"N\" key for move-continuous; \t\"R\" key for rotate; \"T\" key for rotate-again; \"TAB\" key for rotate by 90 degree; \"U\" key for undo; ESC, right mouse click to end")
  96.         (setq gr (grread nil 14 0))
  97.         (cond
  98.           ((or (equal gr '(2 115)) (equal gr '(2 83))) (progn (setq s nil) (mcr)))
  99.           ((or (equal gr '(2 112)) (equal gr '(2 80))) (progn (setq p (getpoint "\nPick base point : ")) (setq llp nil) (setvar 'LASTPOINT p)))
  100.           ((or (equal gr '(2 99)) (equal gr '(2 67))) (do_C))
  101.           ((or (equal gr '(2 100)) (equal gr '(2 68))) (do_CC))
  102.           ((or (equal gr '(2 97)) (equal gr '(2 65))) (do_CCC))
  103.           ((or (equal gr '(2 109)) (equal gr '(2 77))) (do_M))
  104.           ((or (equal gr '(2 110)) (equal gr '(2 78))) (do_MM))
  105.           ((or (equal gr '(2 114)) (equal gr '(2 82))) (do_R))
  106.           ((or (equal gr '(2 116)) (equal gr '(2 84))) (do_RR))
  107.           ((or (equal gr '(2 117)) (equal gr '(2 85))) (do_U))
  108.           ((equal gr '(2 9)) (do_RT))
  109.           ((or (equal gr '(2 27)) (eq (car gr) 11) (eq (car gr) 25)) (setq loop nil))
  110.         )
  111.       )
  112.       (progn
  113.         (setq s (ssget "_:L"))
  114.         (setq p (getpoint "\nPick base point : "))
  115.         (setvar 'LASTPOINT p)
  116.         (mcr)
  117.       )
  118.     )
  119.   )
  120.   (mcr)
  121.   (*error* nil)
  122.   (princ)
  123. )
  124.  

And you're welcome Hugo, regards, M.R. :wink:
« Last Edit: October 06, 2012, 03:25:34 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube