Problem
I have tried to create a script that uses the current selection in the model to perform an action.
I want to be able to:
- select several beams in the model -> run a script (python) -> Script modifies the selected beams (hinges, types, etc.)
OR - Run a script (python) -> Prompt to select objects in the model -> Enter -> Selected objects are modified.
Is that possible?
I am using the RFEM_Python_Client Repository and I have tried with the "GetObjectNumbersByType" and "ObjectsInfo.AllSelectedObjectsInfo"
If I understand correctly the functionality I wish for is not possible with these classes.
Current code
If it helps I have the following code that retrieves all nodes in the opened model. I want it to only retrieve the ones I have selected.
from RFEM.initModel import *
from RFEM.enums import *
from RFEM.BasicObjects.node import Node
Model(new_model=False, model_name="Script Tester", delete=False, delete_all=False)
from RFEM.Tools.GetObjectNumbersByType import GetObjectNumbersByType
selected_nodes = GetObjectNumbersByType(ObjectTypes.E_OBJECT_TYPE_NODE)
# Get information for each selected node
selected_nodes_info = []
for node_no in selected_nodes:
node_data = Node.GetNode(node_no)
selected_nodes_info.append({
'number': node_data.no,
'coordinates': (node_data.coordinate_1, node_data.coordinate_2, node_data.coordinate_3),
'comment': getattr(node_data, 'comment', '')
})
# Example: print the info
for info in selected_nodes_info:
print(info)