is there any way to make output slot on Data mining on script? #359
-
is there any way to script this work?Hello I am Kyungmin Nam in Korea. I tried to make Data mining node's result to be output result, but I couldn't find any way. Also, they have str location that I could't try pyoptislang's register output slot by location function. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Hi @Knam-Ansys, what optiSLang and pyoptislang version are you using? |
Beta Was this translation helpful? Give feedback.
-
@Knam-Ansys I fear, the location registration support for the DataMining node is somewhat poor still in 24R2. It has been improved in 25R1, so if possible switch to 25R1. In 24R2, in order to register the output slot, you will need to provide the full set of arguments to the register_location_as_output_slot method, including slot name and reference value. The reference value may be difficult to provide, as the type and structure depend on the location type. Easiest way would be to register the output slot once in GUI, connect to the project (via pyoptislang) and obtain the currently registered output slots for the DataMining node (including reference values). Then you know, what exactly to provide to the register_location_as_output_slot method. |
Beta Was this translation helpful? Give feedback.
-
@Knam-Ansys I fear, this is not yet supported with 24R2 for the DataMining Actor. @stefanmarth @ansDArnold do you have any suggestions? |
Beta Was this translation helpful? Give feedback.
-
Hello, @rfahlberg Thanks to your previous help, I tested it with 25R1 Optislang and the latest pyOptislang (24.12.03).
Could you possibly provide a very simple example of creating an output slot for Data Mining, as shown in the screenshot I tested? Below is a base code that I tried to make output slot. from ansys.optislang.core import Optislang
from ansys.optislang.core.tcp.nodes import TcpProxySolverNodeProxy
from ansys.optislang.core.tcp import server_commands as sc
from ansys.optislang.core.tcp.osl_server import TcpOslServer
from ansys.optislang.core.tcp import server_queries as queries
def setup_test(osl):
root_system = osl.application.project.root_system
server: TcpOslServer = root_system._osl_server
filter_node: TcpProxySolverNodeProxy = root_system.create_node(type_='DataMining', name="Data Mining")
append_designs_property = {
'OValidatedMDBPath': [{
'First': {'name': 'AppendDesignsToFile'},
'Second': [{'design_container': []}, {'string': 'IDesigns'}, {'string': 'IPath'}]
}]
}
server.send_command(
sc.set_actor_property(
actor_uid=filter_node.uid,
name='DataMiningManager',
value={"id_filter_list_map": append_designs_property}
)
)
# Register output command
# filter_node.register_location_as_output_slot(
# location='OValidatedMDBPath', # <-which requires dict type
# name='OValidatedMDBPath',
# reference_value=None)
filter_node_get_output_slots = filter_node.get_output_slots()
filter_node_actor_registered_output_slots = server.send_command(
queries.actor_registered_output_slots(uid=filter_node.uid))
print("1")
if __name__ == "__main__":
opf_path = r"C:\Custom\Optislang\251_test.opf"
osl = Optislang(ini_timeout=30, loglevel="info")
osl.application.new()
try:
setup_test(osl)
except Exception as e:
print(f"ERROR: {str(e)}")
import traceback
print(traceback.format_exc())
finally:
osl.application.save_as(file_path=r"C:\Custom\Optislang\251_test2.opf")
osl.dispose() Thank you. |
Beta Was this translation helpful? Give feedback.
@Knam-Ansys With 25R1,you should be able to do the following:
For the property editing you can use the explicit API function (set_property) as…