|
5 | 5 | from jinja2 import Template |
6 | 6 | from pathlib import Path |
7 | 7 |
|
8 | | -def initialize_server(ansys_path=None): |
| 8 | +def initialize_server(ansys_path=None, include_composites=False, include_sound=False): |
9 | 9 | server = dpf.start_local_server(ansys_path=ansys_path) |
10 | 10 | print(f"Ansys Path: {server.ansys_path}") |
11 | 11 | print(f"Server Info: {server.info}") |
12 | 12 | print(f"Server Context: {server.context}") |
13 | 13 | print(f"Server Config: {server.config}") |
14 | 14 | print(f"Server version: {dpf.global_server().version}") |
15 | | - print("Loading Composites Plugin") |
16 | | - load_library( |
17 | | - Path(server.ansys_path) / "dpf" / "plugins" / "dpf_composites" / "composite_operators.dll" |
18 | | - ) |
19 | | - print("Loading Acoustics Plugin") |
20 | | - load_library(Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll") |
| 15 | + if include_composites: |
| 16 | + print("Loading Composites Plugin") |
| 17 | + load_library( |
| 18 | + Path(server.ansys_path) / "dpf" / "plugins" / "dpf_composites" / "composite_operators.dll" |
| 19 | + ) |
| 20 | + if include_sound: |
| 21 | + print("Loading Acoustics Plugin") |
| 22 | + load_library(Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll") |
21 | 23 | return server |
22 | 24 |
|
23 | 25 |
|
@@ -59,30 +61,23 @@ def fetch_doc_info(server, operator_name): |
59 | 61 | } |
60 | 62 | ) |
61 | 63 | properties = spec.properties |
62 | | - if "plugin" in properties: |
63 | | - plugin = properties["plugin"] |
| 64 | + plugin = properties.pop("plugin", "N/A") |
| 65 | + |
| 66 | + category = properties.pop("category", None) |
| 67 | + |
| 68 | + scripting_name = properties.pop("scripting_name", None) |
| 69 | + if category and scripting_name: |
| 70 | + full_name = category + "." + scripting_name |
64 | 71 | else: |
65 | | - plugin = "N/A" |
66 | | - try: |
67 | | - scripting_name = properties["scripting_name"] |
68 | | - full_name = properties["category"] + "." + properties["scripting_name"] |
69 | | - except KeyError: |
70 | | - scripting_name = None |
71 | 72 | full_name = None |
72 | | - try: |
73 | | - user_name = properties["user_name"] |
74 | | - except KeyError: |
75 | | - user_name = operator_name |
76 | | - try: |
77 | | - category = properties["category"] |
78 | | - op_friendly_name = category + ": " + user_name |
79 | | - except KeyError: |
80 | | - category = "" |
81 | | - op_friendly_name = user_name |
82 | | - try: |
83 | | - license = properties["license"] |
84 | | - except KeyError: |
85 | | - license = "None" |
| 73 | + |
| 74 | + user_name = properties.pop("user_name", operator_name) |
| 75 | + |
| 76 | + op_friendly_name = user_name |
| 77 | + if category: |
| 78 | + op_friendly_name = category + ":" + op_friendly_name |
| 79 | + |
| 80 | + license = properties.pop("license", "None") |
86 | 81 | scripting_info = { |
87 | 82 | "category": category, |
88 | 83 | "plugin": plugin, |
@@ -136,6 +131,8 @@ def main(): |
136 | 131 | "--ansys_path", default=None, help="Path to Ansys DPF Server installation directory" |
137 | 132 | ) |
138 | 133 | parser.add_argument("--include_private", action="store_true", help="Include private operators") |
| 134 | + parser.add_argument("--include_composites", action="store_true", help="Include composites operators") |
| 135 | + parser.add_argument("--include_sound", action="store_true", help="Include sound operators") |
139 | 136 | args = parser.parse_args() |
140 | 137 | desired_plugin = args.plugin |
141 | 138 |
|
|
0 commit comments