-
[DPF] An unexpected error occurred - rst file used by another program
Hello, I'm writing some codes in DPF in a python result inside my modal analysis, so I need to read the rst file with the dataSource accessed with the "dpf.DataSources(analysis.ResultFileName)" command. My code works well, but when I want to resolve my modal analysis, it shows this error : An unexpected error occurred :…
-
How to plot within a Python result the total stiffness energy in a named selection with ansys dpf ?
Hello everyone, As the title suggest, I want to plot within a Python result the total stiffness energy in a named selection with ansys dpf. I made something that plot the stiffness energy by element on a given named selection, and I think I have to use fields operators to plot the total stiffness energy on the named…
-
Python Code object to change objects Before Solve in R2021.2
I want to run a script that updates pressure objects before Solve (as a workaround to some bug in R2021.2 related to not correctly updating the Y-Axis data when opening the WB). But it seems the Python Code object can only read properties in R2021.2, when it is called as 'Before Solve'. When trying to modify a pressure…
-
Question regarding changing user defined charts' time steps using a python result script.
Hi I have a python result file that I am trying to get some custom result files evaluated in different time steps. for some reason I cannot find a method under a user plot object that would be similar to "Retrieve this result" as opposed to "Evaluate all results. In any case the application does not perform a "Evaluate all…
-
Ansys Mechanical Scrpting (Python): How to set direction of directional shear force?
Hello, I am trying to create a beam result for a directional shear force (in y- & z-axis). But this options seems not to exist as a method (at least I can't find it in the API Reference Guide). For directional bending moments, it is easily possible: yMoment = mySolution.AddDirectionalBendingMoment()…
-
Microsoft Authentication Library support for Ansys Plugin
Need help regarding Microsoft Authentication Library support for Ansys Plugin.
-
Reading excel file in ACP using scripting
Hi I would like to read excel file in ACP, but I'm not able to import for example openpyxl module. I need to use excel because of some further calculations in it. Is there any way how to install this package?
-
change power/ground nets to signal net in edb api
Hi, I want to change the power nets to signal nets in edb api. I could not find a method in the documentation for this. I would appreciate if anyone knows how to do it. Thanks
-
How to make total mass of a part as an Output parameter in Mechanical using Python Code object?
In ANSYS Mechanical, we can make the mass of all bodies as a parameter, but, if one wants mass of a multibody Part or an assembly, the Parameter option is not available.
-
How to get stress values along a path using DPF considering element orientations defined on body?
Hi guys Would need help understand how to retrieve stress tensor values on a path considering: element orientations the are defined in the associated body, layer, and position . Similar to a user plot defined on a path: I have developed the module to retrieve the nodes on the path and I have a named selection of the…
-
How to make a property read only in python result plot
Hi everyone Here's an easy one. Would like to know the function that sets the a python result property to read only or locked so that it cannot be changed by the user. Thanks
-
How can I populate the tabular data section of a python result Plot?
Hi , was wondering if there is a quick sample on how to get custom data to display in the tabular data section of a python result plot. For instance in my case, I calculate a certain value for specific nodes and want the tabular data to show the node and the corresponding value for the node. Would appreciate any help in…
-
Creating custom charts, using python result plots
Hi Is there an example anywhere on how to use charts with python results? basically what are the requirements for the tree item allowed for the chart as input selections. And how can cater my python result file to be an acceptable selection for the chart?
-
Need help updating python result property upon changing another property.
Hi again Was wondering if someone would know how to setup a python result property that updates another property upon change. For example, when I change the Weaker plate material field, I would like the weld strength to be updated with it to what ever value I have associated to the plate. You can assume that I am using…
-
Is there any documentation for the Ansys.UI.Toolkit?
With only the helper comments that come up with the autocomplete, it is very difficult. For example, adding a RadioButton to a UI does not follow the same protocols as a Button
-
Export data from a chart object to text or csv using Python
Hello, I am able to access the chart object using Python, but I am not sure what function will export it to a text or csv file. I checked the list of attributes, and none of them offer the "Export" of chart data. I am guessing since the chart object has a table, there should be some way to access it. Can someone point me…
-
How do I find the latest compatible servicelayer versions with Granta STK?
Is there an easy way to get this? Also, where can we link these versions to Granta MI versions? Question posed by @Rali
-
How to get value in CAD Parameters to python variable?
Hello, can you help me to get value of highlighted parameter to python variable? Thank you
-
How do I parametrize a layered section?
I want to parametrize the angle and thickness of the plies in the Mechanical object "Layered Section". How can I do that?
-
Set workbench user preferences on program start
Hello, According to the documentation I can set the options of the workbench via a journal file: Note: An IT manager can a place a site-wide configuration file into the installation directory of each client machine to ensure that the Workbench software preferences are configured as the company requires. To force a…
-
Get Centroid or coordinates of Remote points
Hello, I automatize join connections in my assembly. I wrote a script to create remote points on each of components. Now I would like to measure the distance between the remote points and identify corresponding pairs. However I have not found any property of Remote point giving me its centroid or coordinates. Do you have…
-
Mechanical ACT Documentation
Hello, is there any consolidated documentation of commands, functions and properties for scripting in mechanical using python? I often got stuck looking for the desired function/property. ACT Reference quide is quite poor documentation. Also best practises as listing availible stuff in console are welcome. Thank you
-
I want to find circle edges in mechanical model
I wrote following code to get ID´s of circle edges : g = ExtAPI.DataModel.Project.Model.Geometry allbodies = g.GetChildren[Ansys.ACT.Automation.Mechanical.Body](True) geo_bodies = [x.GetGeoBody() for x in allbodies if x.Suppressed == False] circles=[] for geo in geo_bodies: for edge in geo.Edges: if edge.Type ==…
-
How can I export design point data from optiSLang .omdb file as .json file by script?
I need to export the design point data from an existing .omdb file as .json file. I know this can be done manually by selecting the designs in the design table (in optiSLang GUI or in optiSLang Postprocessing) -> Rightclick -> Export designs. How can I do this by script?
-
Export results to VTK format
I am trying to export each time step of my analysis (available as rst file) into the VTK format using a python script and ansys.dpf.core. I don't want to save the whole model, but only a selection of elements, which I have as named_selection. This seems to work in general with my script (see below). The problem I have is…
-
How do I create nCode Weld definition file from Mechanical?
-
Is it possible to use the DPF out of an ACT extension?
(Ansys Mechanical 2022 R2) Is it possible to insert a postobject with the DPF and not use the collector in an ACT extension?
-
What is your favourite package in the Python standard library and why?
And least favourite? I really like getpass and dataclasses myself. dataclasses makes class creation so much quicker and easier whilst enforcing type hinting in an easy-to-understand way. It's just a really nice addition to the language. Although getpass is great too, because it does one small thing very well. If you don't…