Author Topic: Move 3d objects to same axis Z  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

antistar

  • Guest
Move 3d objects to same axis Z
« on: September 12, 2011, 03:37:32 PM »
Hi to all.
I need help.
Anyone know a routine that moves the extruded objects selected for the Z axis of the tallest object? Applying then "substract".

Thanks in advance.

BlackCADDER

  • Mosquito
  • Posts: 17
Re: Move 3d objects to same axis Z
« Reply #1 on: September 12, 2011, 11:01:49 PM »
yes, finally I can contribute something. I use this command a lot for 3D work, may be what you
are looking for.  The typed input elevation is set for metric to 3 decimal places.


Code: [Select]
(defun c:mz (/ obj_ss base_ucs_pt base_wcs_pt new_WCS_p new_UCS_pt)
    (princ "\n MOVE SELECTED OBJECTS TO NEW <<WCS>> Z ELEVATION")
    (setq obj_ss (ssget))
    (setq base_ucs_pt (getpoint "\nBase point: "))
    (setq base_wcs_pt (trans base_ucs_pt 1 0))
    (if (= (type new_elev) 'STR) (setq new_elev nil))
    (setq new_elev (DmUreal 0 "Pick" "<type new elevation>\Pick point" new_elev))
    (if (= new_elev "Pick")
        (progn
            (setq ucs_p1 (getpoint "\nPick point:"))
            (setq wcs_p1 (trans ucs_p1 1 0))
            (setq new_elev (nth 2 wcs_p1))
            (princ (strcat "\nNew Elevation = " (rtos new_elev 2 3)))
        )
    )
    (setq new_WCS_pt (list (nth 0 base_wcs_pt) (nth 1 base_wcs_pt) new_elev))
    (setq new_UCS_pt (trans new_WCS_pt 0 1))
    (command ".move" obj_ss "" base_UCS_pt new_UCS_pt)
    (princ)
)
(defun DmUreal (bit kwd msg def / msg bit inp)
    (if def
         (setq msg (strcat "\n" msg " <" (rtos def 2 3) "> : ")
               bit (* 2 (fix (/ bit 2))))
         (setq msg (strcat "\n" msg " : ")))
    (initget bit kwd)
    (setq inp (getreal msg))
    (if inp inp def)
)
"Permission to ask a question, sir... "
"Permission granted, Baldrick, as long as isn't the one about where babies come from."

antistar

  • Guest
Re: Move 3d objects to same axis Z
« Reply #2 on: September 13, 2011, 08:58:35 AM »
yes, finally I can contribute something. I use this command a lot for 3D work, may be what you
are looking for.  The typed input elevation is set for metric to 3 decimal places.


Code: [Select]
(defun c:mz (/ obj_ss base_ucs_pt base_wcs_pt new_WCS_p new_UCS_pt)
    (princ "\n MOVE SELECTED OBJECTS TO NEW <<WCS>> Z ELEVATION")
    (setq obj_ss (ssget))
    (setq base_ucs_pt (getpoint "\nBase point: "))
    (setq base_wcs_pt (trans base_ucs_pt 1 0))
    (if (= (type new_elev) 'STR) (setq new_elev nil))
    (setq new_elev (DmUreal 0 "Pick" "<type new elevation>\Pick point" new_elev))
    (if (= new_elev "Pick")
        (progn
            (setq ucs_p1 (getpoint "\nPick point:"))
            (setq wcs_p1 (trans ucs_p1 1 0))
            (setq new_elev (nth 2 wcs_p1))
            (princ (strcat "\nNew Elevation = " (rtos new_elev 2 3)))
        )
    )
    (setq new_WCS_pt (list (nth 0 base_wcs_pt) (nth 1 base_wcs_pt) new_elev))
    (setq new_UCS_pt (trans new_WCS_pt 0 1))
    (command ".move" obj_ss "" base_UCS_pt new_UCS_pt)
    (princ)
)
(defun DmUreal (bit kwd msg def / msg bit inp)
    (if def
         (setq msg (strcat "\n" msg " <" (rtos def 2 3) "> : ")
               bit (* 2 (fix (/ bit 2))))
         (setq msg (strcat "\n" msg " : ")))
    (initget bit kwd)
    (setq inp (getreal msg))
    (if inp inp def)
)

Hi BlackCADDER, thanks for your reply.
His routine is a part of what I need.
I need to move all objects to the same TOP elevation and not to same BOTTOM elevation as it is now.

Regards

BlackCADDER

  • Mosquito
  • Posts: 17
Re: Move 3d objects to same axis Z
« Reply #3 on: September 14, 2011, 12:23:17 AM »
This is what the routine does, but you have to select each object individually. You can select multiple objects, but they will all be moved from the one selected base point.  I use this routine all the time to match elevations of objects.  The elevation you input (by pick or typed) becomes the default elevation for the next move. Also, you can pick your elevation from a different viewport to the viewport you selected the object. I shall try to do a animated gif for you. I need to find out what software the pro's use here.
"Permission to ask a question, sir... "
"Permission granted, Baldrick, as long as isn't the one about where babies come from."

BlackCADDER

  • Mosquito
  • Posts: 17
Re: Move 3d objects to same axis Z
« Reply #4 on: September 14, 2011, 01:51:52 AM »
maybe this image helps
"Permission to ask a question, sir... "
"Permission granted, Baldrick, as long as isn't the one about where babies come from."

antistar

  • Guest
Re: Move 3d objects to same axis Z
« Reply #5 on: September 14, 2011, 12:30:53 PM »
This is what the routine does, but you have to select each object individually. You can select multiple objects, but they will all be moved from the one selected base point.  I use this routine all the time to match elevations of objects.  The elevation you input (by pick or typed) becomes the default elevation for the next move. Also, you can pick your elevation from a different viewport to the viewport you selected the object. I shall try to do a animated gif for you. I need to find out what software the pro's use here.

Hi BlackCADDER,
His routine works perfectly selecting each object and this has helped me a lot.
I will study the form of a future select all objects at once.

Thank you for your attention. Have a nice day.

BlackCADDER

  • Mosquito
  • Posts: 17
Re: Move 3d objects to same axis Z
« Reply #6 on: September 14, 2011, 09:53:31 PM »
a pleasure antistar, you have a great day also
"Permission to ask a question, sir... "
"Permission granted, Baldrick, as long as isn't the one about where babies come from."