Hello everybody,
i am relatively new to Python and i need some help after investigating hours and hours for a solution.
I try to resolve a clash with a python node in dynamo.
I have a mobile crane(loadable family) which can be controlled with some parameters. The angle of the crane’s arm can be changed via the parameter “Auslegerwinkel”. I achieved a changing of the value with the python code once, but i want to iterate over a loop, change the degree by +1 and check every time, if the change of the angle resolves the clash. If so, the method should stop.
I imported the bimorphnode for using the ElementsIntersect method, but every time I run the script I get the following error:
Type Error: “expected List[Element], got FamilyInstance”
Can someone explain to me, what am I missing here?
I implemented your advice but it does not solve the error message
Now I had to add the [0] to the .Add method(line47/48), because without i got always the error “TypeError: expected Element, got List[Object]”
Using the indices for the lists ([0]) the message does not occur anymore. But in the end, there ist still the message from my second post
Or do you have maybe another idea, how to reach my goal of checking a clash everytime I change my parameter?
I had a solution, the Output of my Script looked exactly like the Output of your ZeroTouchNode.
Unfortunately, I was so happy about the solution and forgot to save the code… and after some other steps, Dynamo crashed. I made a screenshot of the code but the beginning is missing.
I recreated the code, but the Error Message occured again.
I post here my screenshot.
In the beginning I also changed the lines 4/5 to :
clr.AddReference('BimorphNodes')
from Revit import Element as Bimorph
Then, typing Bimorph. I could directly select the method “IntersectsElement”
Maybe this information is useful:
The input for my script is the Output of the BimorphNode Element.IntersectsElement and I flatten the Element input before.
Here i tried to write the essential lines again, but another Error occured…
It’s done! I think I misunderstood the thing with the namespace. I am not familiar with all the vocabulary, how i mentioned I before I just started coding weeks ago.
So I changed the two lines with the definition of the Line[Element] to Line[Revit.Elements.Element]