MrScienceOfficer Posted November 15, 2017 Share Posted November 15, 2017 Outside of the formatting issue, it looks fine. Your error isn't related to that code(unless its related to the formatting issue) Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted November 15, 2017 Author Share Posted November 15, 2017 Sorry, can you point out the formatting issue ? Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted November 15, 2017 Share Posted November 15, 2017 https://www.programiz.com/python-programming The section entitled "Few Important Things to Remember" at the end, briefly goes that. I recommend going through other tutorials I found here, https://wiki.python.org/moin/BeginnersGuide/Programmers Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted November 15, 2017 Author Share Posted November 15, 2017 I know that; what I can't figure out is the error. I get an error related to hou.py in the python library. Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted November 15, 2017 Share Posted November 15, 2017 I recommend posting an example file showing the issue like Bonsak suggested. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted November 19, 2017 Author Share Posted November 19, 2017 def theLooper(curNode): for thePrim in curNode.geometry().prims(): primColor = thePrim.floatListAttribValue("Cd") rounded = tuple((round(total,3)) for total in primColor) print(thePrim.number()) print(primColor) print("Theese are the rounded numbers\n"+str(rounded)) #print(round(primColor,3)) dot = hou.Vector3(primColor).dot(hou.Vector3((rounded)) tolerance = 0.000001 if dot >= 1.0-tolerance and dot <=1.0+tolerance: print("match") else: print("no match") if curNode.geometry().findPrimAttrib("Cd"): print("yes") else: print("no") The error is at the `tolerance` variable ? Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted November 19, 2017 Share Posted November 19, 2017 def theLooper(curNode): for thePrim in curNode.geometry().prims(): primColor = thePrim.floatListAttribValue("Cd") rounded = tuple((round(total,3)) for total in primColor) print(thePrim.number()) print(primColor) print("Theese are the rounded numbers\n"+str(rounded)) #print(round(primColor,3)) dot = hou.Vector3(primColor).dot(hou.Vector3((rounded))) # closing parentheses was missing tolerance = 0.000001 if dot >= 1.0-tolerance and dot <=1.0+tolerance: print("match") else: print("no match") if curNode.geometry().findPrimAttrib("Cd"): print("yes") else: print("no") Python tends to throw a syntax error on the following line when a line doesn't complete it's statement i.e. parentheses block not closed. Quote Link to comment Share on other sites More sharing options...
bonsak Posted November 19, 2017 Share Posted November 19, 2017 (edited) You are missing a closing parenthesis at the end of dot = hou.Vector3(primColor).dot(hou.Vector3((rounded))) -b Too late Edited November 19, 2017 by bonsak Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted November 20, 2017 Author Share Posted November 20, 2017 (edited) Common I missed that. I suppose my truncated rounded variable is not working as I thought, if it was the results should be match Since one values gives me a valid float color value; any suggestions on how I can get Houdini to test if the truncated float color value is equal to that of the full float color value ? Edited November 20, 2017 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
MrScienceOfficer Posted November 20, 2017 Share Posted November 20, 2017 Why would it match (and why would you need it to?), your rounding to the .001th decimal place and testing for a tolerance to .00001th place. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.