Considering you like that comment: let me share that node:
Multiplication Factors.dyf (5.1 KB)
The definition below generates all possible pairs.
The last step provides the pair of smallest numbers
Seems a lot of people already gave a response. Here is a quick python script I made in case it is helpful.
factors.dyn (5.3 KB)
It allows you to put in a step size as an input. Also it should allow you to put the range in the wrong order if you do so on accident. Beware though that since it uses a while loop that could potentially never finish that you should always save first, including your Revit project. For example, if it is impossible to find a number using the step size to return factors within the range, it will go on forever since I never put in any hard stop.
One more post. This version will stop itself so there is no infinite looping. It stops once the increasing has reached the point of being more than the max squared, meaning that there will never be a pair of factors within the range.
factors.dyn (5.4 KB)
Hi, I was trying to use your first python node in a graph but it’s not working and gets me this error message:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 8, in
TypeError: iteration over non-sequence of type Int64
Can I ask you why and if is it possible to come up with a solution?
Thank you
That error indicates you are using an item as a list.
Try wrapping the value you input in a list - [IN[0]] in the Python node for the input or use a List.Create node before passing it into Python.
If that doesn’t work, post a screenshot of the python code - there is a lot of stuff in this thread and know which you are referring to is tough.
It did the trick! Thank you very much @jacob.small!
The input was in fact an integer but coming out from a “List.Count” node.
Thank you so much!