nxopentse.cae package

Submodules

nxopentse.cae.postprocessing module

class nxopentse.cae.postprocessing.PostInput(solution: str, subcase: int, iteration: int, resultType: str, identifier: str = '')

Bases: object

A class for declaring inputs used in CombineResults

nxopentse.cae.postprocessing.add_companion_result(solution_name: str, companion_result_file_name: str, reference_type: str = 'Structural')

Add a companion result to a given solution, by file name

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • companion_result_file_name (str) – Full path of the file containing the companion result

  • reference_type (optional, str) – The result reference to add the companion result to. Default is ‘structural’

Notes

Tested in SC2212 Tested in SC2306

nxopentse.cae.postprocessing.check_post_input(post_inputs: List[PostInput]) None

Check if the provided list of PostInput will not return an error when used in CombineResults. Identifiers are checked with separate function check_post_input_identifiers Raises exceptions which can be caught by the user.

Parameters:

post_inputs (List[PostInput]) – The array of PostInput to check.

nxopentse.cae.postprocessing.check_post_input_identifiers(post_inputs: List[PostInput]) None
This function verifies the identifiers in all post_inputs:

Null or empty string. Reserved expression name. Use of an expression which already exists.

Parameters:

post_inputs (List[PostInput]) – The array of PostInput to check.

nxopentse.cae.postprocessing.check_unv_file_name(unv_file_name: str) None

This method loops through all solutions and all companion results in these solutions. It checks if the file name is not already in use by another companion result. And throws an error if so.

Parameters:

unv_file_name (str) – The file name to look for.

nxopentse.cae.postprocessing.combine_results(post_inputs: List[PostInput], formula: str, companion_result_name: str, unv_file_name: str, result_quantity: NXOpen.CAE.Result.Quantity = NXOpen.CAE.Result.Quantity.Unknown, solution_name: str = '') None

Combine results using the given list of PostInput and the settings in arguments.

nxopentse.cae.postprocessing.delete_companion_result(solution_name: str, companion_result_name: str, reference_type: str = 'Structural') None

Delete companion result with given name from the given solution.

Parameters:
  • solution_name (str) – The name of the solution the compnanionresult belongs to

  • companion_result_name (str) – The name of the compnanionresult to delete.

  • reference_type (str) – The type of SimResultReference eg. Structural. Defaults to structral

nxopentse.cae.postprocessing.envelope_results(post_inputs: List[PostInput], companion_result_name: str, unv_file_name: str, envelope_operation: NXOpen.CAE.ResultsManipulationEnvelopeBuilder.Operation, result_shell_section: NXOpen.CAE.Result.ShellSection, result_component: NXOpen.CAE.Result.Component, absolute: bool, solution_name: str = '') None

Notes

Only works in NX1980 or higher due to the use of NXOpen.CAE.ResultsManipulationEnvelopeBuilder Tested in SC2212. Stil issue with companion result not automatically adding (but it gets created an can be added manually after a file close/reopen) Tested in SC2306. Stil issue with companion result not automatically adding (but it gets created an can be added manually after a file close/reopen)

nxopentse.cae.postprocessing.envelope_solution(solution_name: str, result_type: str, companion_result_name: str, unv_file_name: str, envelope_operation: NXOpen.CAE.ResultsManipulationEnvelopeBuilder.Operation, result_shell_section: NXOpen.CAE.Result.ShellSection, result_component: NXOpen.CAE.Result.Component, absolute: bool = False)

Create an envelope for all subcases in the solution with the given parameters for enveloping.

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • result_type (str) – The type of result to use for enveloping (e.g., ‘Stress - Element-Nodal’, ‘Displacement - Nodal’).

  • companion_result_name (str) – The name of the companion result.

  • unv_file_name (str) – The name of the UNV file to write the envelope results to.

  • envelope_operation (NXOpen.CAE.ResultsManipulationEnvelopeBuilder.Operation) – The operation to perform for enveloping.

  • result_shell_section (NXOpen.CAE.Result.ShellSection) – The shell section of the result.

  • result_component (NXOpen.CAE.Result.Component) – The component of the result.

  • absolute (bool, optional) – Flag indicating whether to use absolute values for enveloping (default is False).

Notes

Only works in NX1980 or higher due to the use of NXOpen.CAE.ResultsManipulationEnvelopeBuilder Tested in SC2212. Stil issue with companion result not automatically adding (but it gets created an can be added manually after a file close/reopen) Tested in SC2306. Stil issue with companion result not automatically adding (but it gets created an can be added manually after a file close/reopen)

nxopentse.cae.postprocessing.export_result(post_input: PostInput, unv_file_name: str, si_units: bool = False) None

Export a single result to universal file.

Parameters:
  • post_input (PostInput) – The postinput defining the result to export.

  • unv_file_name (str) – The name of the unv file to export to.

  • si_units (bool [optional]) – If set to True, the units are set to SI units. Defaults to False, which is then the Simcenter default.

Notes

Tested in SC2306

nxopentse.cae.postprocessing.get_element_nodal_value(solution_name: str, subcase: int, iteration: int, result_type: str, element_label: int, result_parameters: NXOpen.CAE.ResultParameters = None) tuple

Retrieve element-nodal values for a specific element in a given solution. Note that the element-nodal values are hard coded to be stress and the maximum of the section for shell elements

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • subcase (int) – The subcase number within the solution.

  • iteration (int) – The iteration number within the subcase.

  • result_type (str) – The type of result to retrieve (e.g. ‘Displacement - Nodal’, ‘Reaction Force - Nodal’, ‘Reaction Moment - Nodal’).

  • element_label (int) – The label of the element for which element-nodal values are to be retrieved.

  • result_parameters (NXOpen.CAE.ResultParameters, optional) – The result parameters to use for the elemental values. Default is ShellSection.Maximum and stress components.

Returns:

A tuple with 3 objects: a list with the node numbers an int which is the number of results per node (numComponents) and a list which containst the element-nodal values: node_index*numComponents + component_index

Return type:

tuple

Raises:
  • IndexError – If the solution_results list is empty.

  • IndexError – If the result_types list is empty.

  • IndexError – If the result_parameters list is empty.

  • IndexError – If element_nodal_data list does not contain expected element-nodal values: XX YY ZZ XY YZ ZX Determinant Mean MaxShear MinPrincipal MidPrincipal MaxPrincipal WorstPrincipal Octahedral Von-Mises

Notes

Tested in SC2212

nxopentse.cae.postprocessing.get_elemental_value(solution_name: str, subcase: int, iteration: int, result_type: str, element_label: int, result_parameters: NXOpen.CAE.ResultParameters = None) tuple

Retrieve elemental values for a specific element in a given solution. Note that the elemental values are hard coded to be stress and the maximum of the section for shell elements

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • subcase (int) – The subcase number within the solution.

  • iteration (int) – The iteration number within the subcase.

  • result_type (str) – The type of result to retrieve (e.g. ‘Displacement - Nodal’, ‘Reaction Force - Nodal’, ‘Reaction Moment - Nodal’).

  • element_label (int) – The label of the element for which elemental values are to be retrieved.

  • result_parameters (NXOpen.CAE.ResultParameters, optional) – The result parameters to use for the elemental values. Default is ShellSection.Maximum and stress components.

Returns:

A list with the requested elemental values.

Return type:

List[float]

Raises:
  • IndexError – If the solution_results list is empty.

  • IndexError – If the result_types list is empty.

  • IndexError – If the result_parameters list is empty.

  • IndexError – If elemental_data list does not contain expected element-nodal values: XX YY ZZ XY YZ ZX Determinant Mean MaxShear MinPrincipal MidPrincipal MaxPrincipal WorstPrincipal Octahedral Von-Mises

Notes

Tested in SC2212

nxopentse.cae.postprocessing.get_full_result_names(post_inputs: List[PostInput], solution_results: List[NXOpen.CAE.SolutionResult]) List[str]

This function returns a representation of the Results used in PostInputs. Note that the representation is taken from the SolutionResult and not the SimSolution!

Parameters:
  • post_inputs (List[PostInput]) – The list of PostInput defining the results.

  • solution_results (List[NXOpen.CAE.SolutionResult]) – The solution results from which the representation is obtained.

Returns:

List of string with each representation.

Return type:

List[str]

nxopentse.cae.postprocessing.get_nodal_value(solution_name: str, subcase: int, iteration: int, result_type: str, node_label: int) List[float]

Retrieve nodal values for a specific node in a given solution.

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • subcase (int) – The subcase number within the solution.

  • iteration (int) – The iteration number within the subcase.

  • result_type (str) – The type of result to retrieve (e.g. ‘Displacement - Nodal’, ‘Reaction Force - Nodal’, ‘Reaction Moment - Nodal’).

  • node_label (int) – The label of the node for which nodal values are to be retrieved.

Returns:

A list with the nodal values.

Return type:

List[float]

Raises:
  • IndexError – If the solution_results list is empty.

  • IndexError – If the result_types list is empty.

  • IndexError – If the result_parameters list is empty.

  • IndexError – If nodal_data list does not contain expected nodal values.

Notes

Tested in SC2212

nxopentse.cae.postprocessing.get_nodal_values(solution_name: str, subcase: int, iteration: int, result_type: str, node_labels: List[int]) Dict[int, List[float]]

Retrieve nodal values for a list of nodes in a given solution. Use this iso looping get_nodal_value for performance.

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • subcase (int) – The subcase number within the solution.

  • iteration (int) – The iteration number within the subcase.

  • result_type (str) – The type of result to retrieve (e.g. ‘Displacement - Nodal’, ‘Reaction Force - Nodal’, ‘Reaction Moment - Nodal’).

  • node_labels (List[int]) – The labels of the nodes for which nodal values are to be retrieved.

Returns:

An ordered dictionary mapping node labels to a List[float] with nodal data.

Return type:

Dict[int, List[float]]

Notes

Tested in SC2212

nxopentse.cae.postprocessing.get_result_component_names() Dict[int, str]

Get the names of the available result components in order to give meaningful feedback

Returns:

A dictionary with the int value and the string value of the result component

Return type:

Dict[int, str]

Notes

Warning: this assumes that the enum is ordered according the values by the NXOpen developers!! Tested in SC2212

nxopentse.cae.postprocessing.get_result_paramaters(result_types: List[NXOpen.CAE.BaseResultType], result_shell_section: NXOpen.CAE.Result.ShellSection, result_component: NXOpen.CAE.Result.Component, absolute: bool) List[NXOpen.CAE.ResultParameters]
nxopentse.cae.postprocessing.get_result_shell_section_names() Dict[int, str]

Get the names of the available result shell section names in order to give meaningful feedback

Returns:

A dictionary with the int value and the string value of the result shell section

Return type:

Dict[int, str]

Notes

Warning: this assumes that the enum is ordered according the values by the NXOpen developers!! Tested in SC2212

nxopentse.cae.postprocessing.get_result_types(post_inputs: List[PostInput], solution_results: List[NXOpen.CAE.SolutionResult]) List[NXOpen.CAE.BaseResultType]

Helper function for CombineResults and GetResultParameters. Returns the ResultTypes specified in PostInputs

Parameters:
  • postInputs (List[PostInput]) – The input as an array of PostInput.

  • solutionResults (List[NXOpen.CAE.SolutionResult]) – The already loaded results to search through for the results.

Returns:

Returns the result objects

Return type:

List[NXOpen.CAE.BaseResultType]

nxopentse.cae.postprocessing.get_results_manipulation_envelope_builder_operation_names() Dict[int, str]

Get the names of the available operations in order to give meaningful feedback

Returns:

A dictionary with the int value and the string value of the operation

Return type:

Dict[int, str]

Notes

Warning: this assumes that the enum is ordered according the values by the NXOpen developers!! Tested in SC2212

nxopentse.cae.postprocessing.get_results_units(base_result_types: List[NXOpen.CAE.BaseResultType]) List[NXOpen.Unit]
This funciton returns the unit of the first component in each resulttype.

Note that the unit is taken from the SolutionResult and not the SimSolution!

Parameters:

base_result_types (List[NXOpen.CAE.BaseResultType]) – The list of baseresulttypes defining the result

Returns:

A list of unit for each resulttype

Return type:

NXOpen.Unit

Notes

Tested in 2306.

nxopentse.cae.postprocessing.get_sim_result_reference(solution_name: str, reference_type: str = 'Structural') NXOpen.CAE.SimResultReference

Helper function for CombineResults and EnvelopeResults. Returns the SimResultReferece for the given solution

Parameters:
  • solution_name (str) – The solution for which to get the “structural” SimResultReference.

  • reference_type (str) – The type of SimResultReference eg. Structural. Defaults to structral

Returns:

Returns the “Structural” simresultreference.

Return type:

NXOpen.CAE.SimResultReference

nxopentse.cae.postprocessing.hello()
nxopentse.cae.postprocessing.load_results(post_inputs: List[PostInput], reference_type: str = 'Structural', sim_part: NXOpen.CAE.SimPart = None) List[NXOpen.CAE.SolutionResult]

Loads the results for the given list of PostInput and returns a list of SolutionResult. An exception is raised if the result does not exist (-> to check if CreateReferenceResult raises error or returns None)

Parameters:
  • post_inputs (List[PostInput]) – The result of each of the provided solutions is loaded.

  • reference_type (str) – The type of SimResultReference eg. Structural. Defaults to structral

  • sim_part (NXOpen.CAE.SimPart) – The SimPart to load the results on. Defaults to None, which means the current work part.

Returns:

Returns a list of SolutionResult.

Return type:

NXOpen.CAE.SolutionResult

nxopentse.cae.postprocessing.write_submodel_data_to_file(solution_name: str, group_name: str) None

Write nodal displacement .csv file for each subcase in the solution, for the nodes in a given group. This file omits ‘NODE LABEL’ and ‘MAGNITUDE” such that it can be directly used as a field to apply displacements in a submodel.

Parameters:
  • solution_name (str) – The name of the solution containing the results.

  • solution_name – The group containing the nodes for which to write the data to file

Notes

Tested in SC2212

nxopentse.cae.preprocessing module

nxopentse.cae.preprocessing.add_constraint_to_solution(solution_name: str, constraint_name: str) None

This function adds a constraint with the given name to the solution with the given name.

Parameters:
  • solution_name (str) – The name of the solution to add the constraint to

  • constraint_name (str) – The name of the constraint to add

Notes

Tested in SC2212 Tested in SC2312

nxopentse.cae.preprocessing.add_constraint_to_subcase(solution_name: str, subcase_name, constraint_name: str) None

This function adds a constraint with the given name to subcase witht he given name within the solution with the given name.

Parameters:
  • solution_name (str) – The name of the solution to add the constraint to

  • subcase_name (str) – The name of the subcase within the solution to add the constraint to

  • constraint_name (str) – The name of the constraint to add

Notes

Tested in SC2212

nxopentse.cae.preprocessing.add_load_to_solver_set(solver_set_name: str, load_name: str) None

This function adds a load with a given name to a SolverSet with a given name.

Parameters:
  • solver_set_name (str) – The name of the solver set to add the load to.

  • load_name (str) – The name of the load to add to the solver set.

Notes

Tested in SC2312

nxopentse.cae.preprocessing.add_load_to_subcase(solution_name: str, subcase_name: str, load_name: str) None

This function adds a given load to a given solution and subcase.

Parameters:
  • solution_name (str) – The name of the solution containing the subcase.

  • subcase_name (str) – The name of the subcase to add the load to.

  • load_name (str) – The name of the load to add

This function cycles through all cae groups in a CaePart. For each group it adds the related nodes and elements for the bodies and faces in the group. Practical for repopulating groups after a (partial) remesh. Function is idempotent.

Parameters:

fem_part (NXOpen.CAE.FemPart) – The CaePart to perform this operation on.

Notes

Tested in SC2306

nxopentse.cae.preprocessing.add_solver_set_to_subcase(solution_name: str, subcase_name: str, solver_set_name: str) None

This function adds a given SolverSet to a given solution and subcase.

Parameters:
  • solution_name (str) – The name of the solution containing the subcase.

  • subcase_name (str) – The name of the subcase to add the solver set to.

  • solver_set_name (str) – The name of the solver set to add.

Notes

Tested in SC2312

nxopentse.cae.preprocessing.copy_groups_to_sim_part(sim_part: NXOpen.CAE.SimPart = None, groups_in_screenshots: List[str] = []) List[NXOpen.CAE.CaeGroup]
nxopentse.cae.preprocessing.create_2dmesh_collector(thickness: float, color: int = None) NXOpen.CAE.MeshCollector | None
This function creates a 2d mesh collector with the given thickness and label.

the color of the mesh collector is set as 10 times the label

Parameters:
  • thickness (float) – The thickness to set in the mesh collector

  • physical_property_label (int) – The label of the physical property. Needs to be unique and thus cannot already be used in the part.

Returns:

Returns the created 2d mesh collector.

Return type:

NXOpen.CAE.MeshCollector

nxopentse.cae.preprocessing.create_cartesian_formula_field(variable_name: str, variable_type: str, unit: NXOpen.Unit, formula: str, field_name: str, work_part: NXOpen.CAE.CaePart = None) NXOpen.Fields.SpatialMap
This function creates a field (spatial map) in which the value of a given variable is calculated based on a formula.

This formula can depend on the global coordinates x, y and z.

Parameters:
  • variable_name (str) – The name of the dependent domain, as displayed in the ‘Name’ column of the ‘Dependent Domain’ section in the GUI (e.g. ‘pressure’)

  • variable_type (str) – The name of the dependent domain, as displayed in the Pulldown of the ‘Dependent Domain’ section in the GUI (e.g. ‘Pressure’)

  • unit (NXOpen.Unit) – The unit of the variable. (e.g. work_part.UnitCollection.FindObject(“PressureNewtonPerSquareMilliMeter”))

  • formula (str) – The formula as provided in the ‘Definition’ section in the GUI (e.g. ‘ug_val(x) * 10’)

  • field_name (str) – The name of the field.

  • work_part (NXOpen.CAE.CaePart (Optional)) – The part to create the field in. If None, the work part is used.

Returns:

Returns the created moment.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_displacement_field(field_name: str, file_name: str) NXOpen.Fields.FieldTable

Creates a displacement field which can be used in an enforced displacement constraint. When creating a break-out model or submodel

Parameters:
  • field_name (str) – The name to give to the field

  • file_name (str) – Full path of the file with the nodal coordinates and displacement values

Returns:

The field just created

Return type:

NXOpen.Fields.FieldTable

Notes

The file with coordinates and displacements can be generated with write_submodel_data_to_file Tested in SC2212

nxopentse.cae.preprocessing.create_force_on_group(group_name: str, fx: float, fy: float, fz: float, force_name: str, group_filter_type: NXOpen.CAE.CaeSetGroupFilterType.GeomEdge) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • group_name (str) – The name of the group to apply the force to.

  • fx (float) – the force in global x-direction in Newton.

  • fy (float) – the force in global y-direction in Newton.

  • fz (float) – the force in global z-direction in Newton.

  • force_name (str) – The name of the force for the GUI.

  • group_filter_type (NXOpen.CAE.CaeSetGroupFilterType) – The object type the filter from the group.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_force_on_selection_recipe(selection_recipe_name: str, fx: float, fy: float, fz: float, force_name: str, selection_recipe_filter_type: NXOpen.CAE.CaeSetGroupFilterType.GeomEdge) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • selection_recipe_name (str) – The name of the selection recipe to apply the force to.

  • fx (float) – the force in global x-direction in Newton.

  • fy (float) – the force in global y-direction in Newton.

  • fz (float) – the force in global z-direction in Newton.

  • force_name (str) – The name of the force for the GUI.

  • group_filter_type (NXOpen.CAE.CaeSetGroupFilterType) – The object type the filter from the group.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_linear_acceleration(gx: float, gy: float, gz: float, force_name: str, sim_part: NXOpen.CAE.SimPart = None) NXOpen.CAE.SimBC | None

Create or edit a linear acceleration load in a SimPart.

Parameters:
  • gx (float) – The acceleration in the x-direction in mm/s^2.

  • gy (float) – The acceleration in the y-direction in mm/s^2.

  • gz (float) – The acceleration in the z-direction in mm/s^2.

  • forceName (str) – The name of the load to create or edit.

Returns:

The created or edited SimBC object.

Return type:

NXOpen.CAE.SimBC

Notes

Use create_linear_acceleration(0, 0, -9810, “Gravity”) to create a gravity load Tested in SC2212

nxopentse.cae.preprocessing.create_moment_on_group(group_name: str, mx: float, my: float, mz: float, moment_name: str, group_filter_type: NXOpen.CAE.CaeSetGroupFilterType.GeomEdge) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • group_name (str) – The name of the group to apply the moment to.

  • fx (float) – the moment in global x-direction in NewtonMeter.

  • fy (float) – the moment in global y-direction in NewtonMeter.

  • fz (float) – the moment in global z-direction in NewtonMeter.

  • moment_name (str) – The name of the moment for the GUI.

  • group_filter_type (NXOpen.CAE.CaeSetGroupFilterType) – The object type the filter from the group.

Returns:

Returns the created moment.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_moment_on_selection_recipe(selection_recipe_name: str, mx: float, my: float, mz: float, moment_name: str, selection_recipe_filter_type: NXOpen.CAE.CaeSetGroupFilterType.GeomEdge) NXOpen.CAE.SimBC

This function creates a moment on the specified items in a selection recipe.

Parameters:
  • selection_recipe_name (str) – The name of the selection recipe to apply the force to.

  • mx (float) – the moment in global x-direction in NewtonMeter.

  • my (float) – the moment in global y-direction in NewtonMeter.

  • mz (float) – the moment in global z-direction in NewtonMeter.

  • moment_name (str) – The name of the moment for the GUI.

  • group_filter_type (NXOpen.CAE.CaeSetGroupFilterType) – The object type the filter from the group.

Returns:

Returns the created moment.

Return type:

NXOpen.CAE.SimBC

Notes

Untested

nxopentse.cae.preprocessing.create_nodal_constraint(node_label: int, dx: float, dy: float, dz: float, rx: float, ry: float, rz: float, constraint_name: str) NXOpen.CAE.SimBC
This function creates a constraint on a node. For free, set the value to -777777

THis is minus 7, six times. Which equals 42 ;) You got to love the NX developers humor.

Parameters:
  • node_label (int) – The node label to appy the constraint to.

  • dx (float) – the displacement in global x-direction.

  • dy (float) – the displacement in global y-direction.

  • dz (float) – the displacement in global z-direction.

  • rx (float) – the rotation in global x-direction.

  • ry (float) – the rotation in global y-direction.

  • rz (float) – the rotation in global z-direction.

  • constraint_name (str) – The name of the constraint for the GUI.

Returns:

Returns the created constraint.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2212 Tested in SC2312

nxopentse.cae.preprocessing.create_nodal_force(node_label: int, fx: float, fy: float, fz: float, force_name: str) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • node_label (int) – The node label to appy the force to.

  • fx (float) – the force in global x-direction in Newton.

  • fy (float) – the force in global y-direction in Newton.

  • fz (float) – the force in global z-direction in Newton.

  • force_name (str) – The name of the force for the GUI.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_nodal_force_default_name(node_label: int, fx: float, fy: float, fz: float)

This function creates a force on a node using a default name.

Parameters:
  • node_label (int) – The node label to appy the force to.

  • fx (float) – the force in global x-direction in Newton.

  • fy (float) – the force in global y-direction in Newton.

  • fz (float) – the force in global z-direction in Newton.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_nodal_moment(node_label: int, mx: float, my: float, mz: float, moment_name: str) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • node_label (int) – The node label to appy the force to.

  • mx (float) – the moment in global x-direction in NewtonMillimeter.

  • my (float) – the moment in global y-direction in NewtonMillimeter.

  • mz (float) – the moment in global z-direction in NewtonMillimeter.

  • force_name (str) – The name of the force for the GUI.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

nxopentse.cae.preprocessing.create_node(label: int, x_coordinate: float, y_coordinate: float, z_coordinate: float) NXOpen.CAE.FENode | None
This function creates a node with given label and coordinates.

It is the user responsibility to make sure the label does not already exists in the model!

Parameters:
  • label (int) – The node label

  • x_coordinate (float) – The global x-coordinate of the node to be created

  • y_coordinate (float) – The global y-coordinate of the node to be created

  • z_coordinate (float) – The global z-coordinate of the node to be created

Returns:

Returns the created node.

Return type:

NXOpen.CAE.FENode

nxopentse.cae.preprocessing.create_pressure_on_group(group_name: str, pressure: float, force_name: str, group_filter_type: NXOpen.CAE.CaeSetGroupFilterType.GeomEdge) NXOpen.CAE.SimBC

This function creates a force on a node.

Parameters:
  • group_name (str) – The name of the group to apply the pressure to.

  • pressure (float) – The magnitude of the pressure in Newton per square meter (Pascals).

  • force_name (str) – The name of the force for the GUI.

  • group_filter_type (NXOpen.CAE.CaeSetGroupFilterType) – The object type the filter from the group.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_solution(solution_name: str, output_requests: str = 'Structural Output Requests1', bulk_data_echo_request: str = 'Bulk Data Echo Request1') NXOpen.CAE.SimSolution | None

This function creates a solution with the given name, updated an existing if one already exists with that name. An optional output requests and bulk data echo request can be provided as parameters. If not provided or the provided is not found the defaults are applied.

Parameters:
  • solution_name (str) – The name of the solution to create

  • output_requests (optional) – The name of the structural ouput request to set for the solution

  • bulk_data_echo_request (optional) – The name of the bulk data echo request to set for the solution

Returns:

Returns the created subcase if created. The existing one with this name and updated if it exists

Return type:

NXOpen.CAE.SimSolution or None

Notes

Tested with only solution name in SC2212. Tested in SC2312 with all parameters.

nxopentse.cae.preprocessing.create_solver_set(solver_set_name: str) NXOpen.CAE.SimLoadSet | None

This function creates a SolverSet with the given name. Does not create if one with the given name already exists.

Parameters:

solver_set_name (str) – The name of the solver set to create

Returns:

Returns the created solver set if created. None otherwise

Return type:

NXOpen.CAE.SimLoadSet or None

Notes

Tested in SC2312

nxopentse.cae.preprocessing.create_subcase(solution_name: str, subcase_name: str) NXOpen.CAE.SimSolutionStep | None

This function creates a subcase with a given name under the given solution. Does not create if already exists.

Parameters:
  • solution_name (str) – The name of the solution to create the subcase under

  • subcase_name (str) – The name of the subcase to create

Returns:

Returns the created subcase if created. None otherwise

Return type:

NXOpen.CAE.SimSolutionStep or None

Notes

Tested in SC2212

nxopentse.cae.preprocessing.get_all_fe_elements(base_fem_part: NXOpen.CAE.BaseFemPart = None) Dict[int, NXOpen.CAE.FEElement]

Get all elements from the model. Note that this is the most performant way to do so.

Parameters:

base_fem_part (NXOpen.CAE.BaseFemPart) – The BaseFemPart to get the elements from.

Returns:

A list of all FEElements in the base_fem_part

Return type:

List[NXOpen.CAE.FEElement]

Notes

Tested in SC2306

nxopentse.cae.preprocessing.get_nodes_in_group(group_name: str) Dict[int, NXOpen.CAE.FENode]

Retrieves nodes belonging to a specified group.

Parameters:

group_name (str) – The name of the group whose nodes are to be retrieved (not case sensitive)

Returns:

An ordered dictionary mapping node labels to FENode objects.

Return type:

Dict[int, NXOpen.CAE.FENode]

Raises:

ValueError – If the group with the specified name is not found or if multiple occurrences are found.:

Notes

Tested in SC2212

nxopentse.cae.preprocessing.get_solution(solution_name: str) NXOpen.CAE.SimSolution | None

This function returns the SimSolution object with the given name. Returns None if not found, so the user can check and act accordingly

Parameters:

solutionName (int) – The name of the solution to return, case insensitive

Returns:

The FIRST solution object with the given name if found, None otherwise

Return type:

NXOpen.CAE.SimSolution or None

nxopentse.cae.preprocessing.hello()
nxopentse.cae.preprocessing.set_field_in_pressure_load(load_name: str, field_name: str) NXOpen.CAE.SimBC

This function sets the field in a pressure load.

Parameters:
  • load_name (str) – The name of the pressure load to apply the field to.

  • field_name (str) – The name of the field to apply as the pressure value.

Returns:

Returns the created force.

Return type:

NXOpen.CAE.SimBC

Notes

Tested in SC2312 Note the unit will be taken from the pressure field. Take care that the unit is correct.

nxopentse.cae.preprocessing.set_solution_property(solution_name: str, property_name: str, property_value: str | int)

Set a property value for a solution.

Parameters:
  • solution_name (str) – The name of the solution to set the property for.

  • property_name (str) – The name of the property to set.

  • property_value (Union[str, int]) – The value to set for the property. It can be either a string or an integer.

Raises:

TypeError – If property_value is not a string or an integer.

Examples

set_solution_property(“MySolution”, “sdirectory”, “C:NXSolveScratch") set_solution_property(“MySolution”, “parallel”, 8) set_solution_property(“MySolution”, “solver command window”, 1)

Notes

Tested in SC2212

nxopentse.cae.solving module

nxopentse.cae.solving.solve_all_solutions()

This function solves all solutions in the active sim file

nxopentse.cae.solving.solve_dat_file(dat_file: str)
This function solves a .dat file by directly calling the nastran.exe executable.

It takes the location of the nastran.exe executable form the environmental variable UGII_NX_NASTRAN. By directly calling the nastran executable, a standalone license for the executable is required! Running this with a desktop license wil result in an error: “Could not check out license for module: Simcenter Nastran Basic”

Parameters:

dat_file (str) – The full path of the .dat file to be solved. If no extension is provided, .dat is assumed. If no directory is provided, assumed same as the sim file

nxopentse.cae.solving.solve_solution(solution_name: str)

This function solves a solution with the given name, in the active sim file

Parameters:

solution_name (str) – Name of the solution to solve

Module contents