Spacebar action in Python

Hi.I want to create elements (such as rebars) and rotate them around their own axes. So far I’ve been able to create these elements, but I have to manually rotate them using the SPACEBAR key. I was wondering if there is python code I should be using, that allows to simulate the SPACEBAR function.
By the way, I’ve searched how to rotate elements, but it seems too much complicated. I just want to simulate the SPACEBAR function in python. Thank you in advance.

@avatar140 ,

Can you share some screenshots or even a try in python?

KR

Andreas

Sure. I just want to replicate the SPACEBAR function, that you would normally use in Revit UI to rotate elements around its own axis, in Python. With this, I wouldn’t have to manually rotate elements by clicking them and pressing space (like in the attached).

autodesk-revit-2022-nar-est2rvt-vista-3d-3d-2022-09-01-11-53-06_zqUYtq71

You could install a Python package like Keyboard to simulate keyboard events such as SPACEBAR. Else forget about SPACEBAR specifically and just call up the rotate command. Alternatively, forget about Python and just use the SetRotation node.

Thanks. I was wondering if there was a script or node to simply emulate keyboard functions that I’m missing. It seems there is none. I will have to use the API docs info to get what I want.