Unable to pass Multiple objects through GeometryResults()

Which tool versions are you using?

SDK: v13.5.0
Platform: v2022.x.x
Python: v3.7
Isolation mode: venv

Current Behavior

I’m trying to get two object out through GeometryResults, one SquareBeam and one Sphere, it gives me the error “TypeError: ‘SquareBeam’ object is not iterable”

Expected Behavior

I was hoping to get both the object out in the web view

Hi ravi,

This is possible, your implementation might be wrong. In order to visualize multiple geometric objects you can use a Group, which you use as input for a single GeometryResult. See the docs for an explainer on using a Group and a code snippet with an example.

Let me know if this fixes your problem.

Hi rdejonge,
Thank you, that works.
I have a question, in the SDK reference for GeometryResult (SDK Reference - Views | VIKTOR Documentation), it says in case of multiple objects we simply specify it as GeometryResults[obj1, obj1…] Did I understand it incorrectly?

I see what you mean. The comments means that you can also specify a list of objects, e.g:

GeometryResult([obj1, obj2])

In your example the parentheses are missing:

GeometryResults[obj1, obj…]

In the documentation we use type hints for the parameters to help you with the accepted types. For the parameter geometry you can use either a TransformableObject (which Group inherits from), a sequence (e.g. a list) of TransformableObjects or a File.

The return value of a view method is always a singular object (e.g. an instance of GeometryResult for a GeometryView)

Thank you, that helped a lot.