Author Topic: Moving UCS's ?  (Read 2599 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Moving UCS's ?
« on: February 16, 2005, 10:44:47 AM »
If I move and rotate my model can I programmatically, move the UCS's and view ports the same amount?

What we are doing is moving the model to state plane coords, and we really don't want to move all the viewports and ucs's by hand if we can help it.

thanks
TheSwamp.org  (serving the CAD community since 2003)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Moving UCS's ?
« Reply #1 on: February 16, 2005, 10:49:05 AM »
Assuming you know the distance and Angle, could you not use -pan and move the viewport the same amount?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Moving UCS's ?
« Reply #2 on: February 16, 2005, 10:56:40 AM »
Quote from: CmdrDuh
Assuming you know the distance and Angle, could you not use -pan and move the viewport the same amount?

I suppose so. Thanks
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
Moving UCS's ?
« Reply #3 on: February 16, 2005, 11:09:05 AM »
Have you already moved your model?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Moving UCS's ?
« Reply #4 on: February 16, 2005, 11:12:17 AM »
Quote from: whdjr
Have you already moved your model?

No not yet.
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
Moving UCS's ?
« Reply #5 on: February 16, 2005, 12:52:56 PM »
Mark,

I have to go out for a while so I will give you what I have so far along with my thought process:
Code: [Select]
(defun *ssnames* (selection_set / num lst)
  (repeat (setq num (sslength selection_set))
    (setq num (1- num)
 lst (cons (ssname selection_set num) lst)
    )
  )
  lst
)

(defun c:marmivp (/ model ins ang vprts mov ent)
  (prompt "Select Model to move and rotate: ")
  (and
    (setq model (ssget ":S:E" '((0 . "INSERT"))))
    (setq ent (entget (ssname model 0)))
    (setq ins (cdr (assoc 10 ent)))
    (not (initget (+ 1 32)))
    (setq mov (getpoint ins "Pick new Location point:  "))
    (not (initget 1))
    (setq ang (getangle "Enter rotation angle:  "))
    (setq ent (subst (cons 10 mov) (assoc 10 ent) ent))
    (setq ent (subst (cons 50 ang) (assoc 50 ent) ent))
    (entmod ent)
    (setq vprts (ssget "X"
      '((0 . "VIEWPORT") (410 . "Layout1") (-4 . "!=") (69 . 1))
)
    )
    (mapcar '(lambda (x)
      (setq lst (mapcar 'assoc '(12 51) (list x x)))
      (trans (car lst) ? ?)
 ;The thought here was take the center of each viewport and trans it
 ;to modelspace and then relocate it using the mov variable and then
 ;trans it back to paperspace.
 ;code 12 is the center of a viewport
 ;code 51 is the rotation (in radians) of a viewport.
 ;Use the subst and entmod method to update the viewports.
    )
   (mapcar 'entget (*ssnames* vprts))
    )
  )
)

Good luck.
Let me know if any of this helps. :)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Moving UCS's ?
« Reply #6 on: February 16, 2005, 01:16:17 PM »
Thanks Will. That's sorta the way I was thinking also.
TheSwamp.org  (serving the CAD community since 2003)