Jump to content

Round off numbers


X0RD

Recommended Posts

Is it possible to round off numbers, not only to hole numbers, but also a multiply of a numbers, for example 1.4, to the would snap on 1.4, 2.8, 4.2, 5.6, ect.?
 
I could like to be able to snap curves to a current height, like this:
 
 
LIq5Z0W.jpg
Link to comment
Share on other sites

Thanks for your input, im able to do this by writing mine first python :D
 

node = hou.pwd()
geo = node.geometry()

# Add code to modify contents of geo.
# Use drop down menu to select examples.


for point in geo.points():
    #print 'My Number: %s' % point.number()
    yPosition = point.position()[1]
    print yPosition
    aPosition = round(yPosition, 3)
    print aPosition
    step = 1.1
    bPosition = aPosition / step
    print bPosition
    cPosition = round(bPosition, 0)
    print cPosition
    dPosition = cPosition * step
    print dPosition
    point.setPosition((point.position()[0], dPosition, point.position()[2]))
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...