Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ansys/motorcad/core/methods/rpc_methods_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ def export_matrices(self, directory_path):
params = [directory_path]
return self.connection.send_and_receive(method, params)

def load_reduced_nodes(self, file_path):
"""Load reduced nodes selection from a file.

Parameters
----------
file_path : str
Filepath for loading the file with the enabled nodes.
Use the ``r'filepath'`` syntax to force Python to ignore
special characters.
"""
method = "LoadReducedNodes"
params = [file_path]
return self.connection.send_and_receive(method, params)

def load_custom_drive_cycle(self, file_path):
"""Load a custom waveform from a file.

Expand Down
14 changes: 14 additions & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ def test_export_matrices(mc):
assert os.path.exists(get_temp_files_dir_path() + r"\temp_test_file.tmf")


def test_load_reduced_nodes(mc):
mc.load_reduced_nodes(get_temp_files_dir_path() + r"\ReducedNodes.rnm")

node_selection = mc.get_variable("ReducedNodeSelection")
reduced_nodes_len = mc.get_variable("ReducedNodeNumber")
reduced_nodes = [
mc.get_array_variable("ReducedNode_NodesToKeep", node) for node in range(reduced_nodes_len)
]

assert node_selection == 2
assert reduced_nodes_len == 7
assert reduced_nodes == [1, 2, 3, 6, 7, 126, 127]


def test_load_fea_result(mc):
mc.show_magnetic_context()

Expand Down
Loading