script for approximate the coordinates

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  4 Weeks Ago
script for approximate the coordinates

Hello, guys!
I looking for a script for approximate the coordinates. It should always be zero after a comma (integer).
You can see how it should look like in the picture. Thanks.


 
  4 Weeks Ago

(
    fn RoundObjectPos node =
    (
        p = node.pos
        node.pos = [int p.x, int p.y, int p.z]
    )

    RoundObjectPos $
)

or

$.pos = [int $.pos.x, int $.pos.y, int $.pos.z]
__________________
Jorge Rodríguez
PolyTools3D
 
  4 Weeks Ago
Hi! 
Thanx.  I found this solution:

for selObjs in selection do (
selObjs.pos.x = floor(selObjs.pos.x + 0.5)
selObjs.pos.y = floor(selObjs.pos.y + 0.5)
selObjs.pos.z = floor(selObjs.pos.z + 0.5)
)
 
  4 Weeks Ago
Originally Posted by dasexp: Hi! 
Thanx.  I found this solution:

for selObjs in selection do (
selObjs.pos.x = floor(selObjs.pos.x + 0.5)
selObjs.pos.y = floor(selObjs.pos.y + 0.5)
selObjs.pos.z = floor(selObjs.pos.z + 0.5)
)

That won't give you the results you showed in the sample image. But if it works for what you need, good for you.

For instance, in your example you have:

[-15.42, -31.649, 1.774] -> [-15, -31, 1]

With the code you found you get:

[-15, -32, 2]
__________________
Jorge Rodríguez
PolyTools3D
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:37 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.