Center to origin

Next
 From:  PaQ
2409.1 
Hi Michael,

Sorry if it has allready be asked, but is it possible to create a little scipt to center (move) a selected entity (surfaces, solids, curves) to the world origin ?
(not sure if the request is clear :))
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2409.2 In reply to 2409.1 
Hi PaQ, yup this is pretty easy to do now since a couple of betas ago I added some stuff so that scripts could access an object's bounding box.

Take the attached file CenterAtOrigin.js and copy it to your v2's \commands sub-folder.

Then set up a keyboard shortcut with CenterAtOrigin (note, no .js at the end, and no script: at the start, just that plain name) as the command part and that should do it.

Please let me know if it does not work for you.

- Michael


EDIT: Updated attachment to new version that centers object at the cplane origin if there is a custom cplane set, otherwise at world origin.

EDITED: 15 Feb 2009 by MICHAEL GIBSON

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  PaQ
2409.3 In reply to 2409.2 
Perfect Michael, thanks a lot !!!!!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Schbeurd
2409.4 
Extremely useful.

Thanks Michael (and thanks to PaQ for asking this... Hehe)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  PaQ
2409.5 In reply to 2409.4 
Hey happy it's handy for you Schbeurd :)

Hi Michael,

Just a other question, is it possible that the 'center at origin' works with the cplane too ? so the selection is center to the cplane origin when you're using a cplane, or to the world when cplane is off. I hate to fell like I'm at in a scipt-supermarket, but it's really not my cup of tea, so thanks for you help.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Colin
2409.6 In reply to 2409.2 
Hi Michael,

Thanks very much for making this & Thanks to PaQ for requesting it.

FWIW I'm using F4 as my keyboard shortcut so it'll match up for use when I'm using Rhino.

regards Colin
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2409.7 In reply to 2409.5 
Hi PaQ,

> Just a other question, is it possible that the 'center at origin'
> works with the cplane too ? so the selection is center to the
> cplane origin when you're using a cplane, or to the world
> when cplane is off.

Yup, it's only a tiny adjustment to make that work.

I've updated the attachment to that previous message
(http://moi3d.com/forum/index.php?webtag=MOI&msg=2409.2)
to work like that now, so just copy that new version over top of the previous one.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  PaQ
2409.8 In reply to 2409.7 
haaaaa really cool, thanks for taking a bit from your time to this script Michael !
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  nameless
2409.9 
I am trying to run this script with a shortcut and the selected object disappears.

When I run it via the script menu at the bottom, the object is centered as expected. Any ideas what could be wrong?

edit: I remember it was working fine at some point- no idea what changed

EDITED: 27 Feb 2022 by NAMELESS

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
2409.10 In reply to 2409.9 
Is the object too small to see? , or is it located outside of the viewing area?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
2409.11 In reply to 2409.9 
Hi nameless,

re:
> I am trying to run this script with a shortcut and the selected object disappears.
>
> When I run it via the script menu at the bottom, the object is centered as expected. Any ideas what could be wrong?

I can't repeat the problem over here, does it happen just with a particular object? If so can you please post a .3dm model file with the object in it?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  nameless
2409.12 
Hi Michael,

Thank you for looking into this. I found what the problem was- Numlock was not pressed when I tried it, so it somehow registered the period as a coordinate or size input.
Trying again with Numlock on and the script works, object is centered just fine.

Apologies for wasting any reader's time with this. :\
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All