-
Centroid of elements
I have 11 elements after meshing, I need the centroid location of each element in a list or file format for using it later. Can someone provide me with the APDL code?
-
Unable to connect Pyprimemesh server.
Hello All, Can anyone guide me, How to launch Ansys pyprimemesh library and connect to server? Rightnow I have ansys 2023R1 licensed version and python 3.9 version. Also installed pyprimemesh file from Github. then afterthat how to use and connect? I am already taking help of pyansys documentary.…
-
How can I show/hide Mesh on a contour result?
How can I show/hide Mesh on a contour result?
-
Migration from v222 to v232
Hi, ExtAPI.DataModel.InternalObject["ds"].Graphics.ResultPrefs.MinOn = FalseExtAPI.DataModel.InternalObject["ds"].Graphics.ResultPrefs.edgeDisplay = 2 This commande perfectly worked in Ansys 2022 R2 but not anymore in v2023 R2. I get the following error message: 'DispCallable' object has no attribute 'MinOn' Can you give…
-
Creating section plane with script
Hi, I would like to create section plane with scripting in Ansys Mechanics. I did a research but did not found anything or forum nor it worked. How I could do that? Thanks.
-
apdl command that allows to write to file large numbers
hello! I'm writing to a file an array, but it only writes the small numbers such as 23.328746 or 0.7 and not any large number like 356236. For the larger numbers it just prints *****. /OUTPUT *CFOPEN,'interpolated_val','txt' *VWRITE,final_val(1,1,1),final_val(1,2,1) %f,%f *CFCLOS do you have any suggestions for this?
-
Getting issue while invoke callback in separate thread in ACT
Hello, In ACT for Mechanical Context, I have a callback which is called on the button click implemented in XML: <callbacks><onclick>run</onclick></callbacks> The run() routine is initialized in .py file as run(context) In such a case, the button is being pressed during the runtime of ACT, and UI is suspended. It looks…
-
Minimum requirements to include enums in embedded instance
Hey everyone, I am currently using an embedded instance of Mechanical in Python. I use the following code to include access to global variables: from ansys.mechanical.core import App, global_variablesapp = mech.App(version=231)globals().update(global_variables(app)) Then I discovered, that enums are still not available…
-
In Mechanical (stand-alone), how do you start a new model or clear the existing model?
Is there a command in Mechanical stand-alone to reset/clear a model completely (similar to the "File -> New" menu command)? Was hoping for something like: ExtAPI.Application.New()
-
In Mechanical how to rename analysis based on names in Workbench ?
Hi, In Workbench, I renamed my analysis. In Mechanical, I have to rename all the analysis. Is there a way with a Python script (or other) to automaticly rename analysis in Mechanical, based on names in Workbench ? Thanks, Jean
-
Read data from txt with apdl commands inserted in tree
Hello everyone! I'm working in workbench mechanical (2022r2) in a coupled field module. I want to insert apdl commands in the tree to read a table and interpolate to get some results. I have a file (txt with values separated by comma)with element ids and for each element i have temperature and two parameters defined.…
-
Writing tabular data of force result item to list (CPython)
I have a script that writes tabular data to a list that works in IronPython. I am trying to convert the script to CPython in order to do some post processing with numpy and pandas. I am getting an AttributeError message. Is there a way to do this in CPython? data = []del data[:]force =…
-
PyMAPDL exits intermittently when run in a loop
Hi, I'm currently running a PyMAPDL script in a for loop. During each iteration, the script makes slight modifications to the mesh and performs a pre-stressed modal analysis. However, I'm encountering an intermittent issue where PyMAPDL exits with the following error message after few iterations: CRITICAL - pymapdl_global…
-
Can someone help me translate this apdl code to pymapdl. I tried multiple things but it didnt work
component = 'CONTACT' cmsel,,component !select Contact Faces acc. component esln !select related Elements ESEL,R,ENAME,,174 !Reselect all Contact Elements in Set *GET,nelem,ELEM,,COUNT !count number of selected nodes on Faces en=0 !initialize Elem Number to 0 *dim,elem_data,,nelem,2 *do,i,1,nelem !loop over nodes en =…
-
Tabular load implemented from Python scripting
Hello everyone I am working in Ansys Workbench 2022R2 in a coupled field module. I am adding loads from scripting. With a single value works easily, but I want to use tabular data for the load. Can i read tabular data for a load from scripting? Can i set the step end time in analysis settings with input from csv?
-
How to process topology optimizations on different geometries automatically?
Hey everyone, my goal is to perform a topology optimization (TO) on 50+ geometries in ANSYS. For a single simulation my current plan is pretty straightforward: I open a new Workbench file, create a static-structural module, connect a topology optimization module to it and basically do all the neccessary steps in ANSYS…
-
Exporting elements ID of contact region
Hello, I am trying to print element ids of the contact region but it gives an error that "CONTACT_01" (name of contact region is not defined., even though I have created a contact with this name and same is present in the .inp file. Below is the code I am using. Pls give suggestions if any. from ansys.mapdl.core import…
-
Changing the coefficient of friction of each element
Hi, I am currently trying to change the coefficient of friction of each element in a contact area. I tried running apdl commands through pymapdl but seems like its not even reading the command file. Can anyone help me with this? I need to extracts element nos. in a contact area and assign unique coefficient of friction…
-
PyMAPDL exits intermittently while running in a loop when mapdl.input() command is used
Hello, I'm encountering an issue while running a PyMAPDL script in a for-loop for a large number of iterations (approximately 8000). In each iteration, I modify the node locations using an input file and then solve the problem. To change the node locations, I utilize the "mapdl.input(update_nodes.inp)" command, which…
-
PyMAPDL exits intermittently while running in a loop when mapdl.input() command is used
Hello, I'm encountering an issue while running a PyMAPDL script in a for-loop for a large number of iterations (approximately 8000). In each iteration, I modify the node locations using an input file and then solve the problem. To change the node locations, I utilize the "mapdl.input(update_nodes.inp)" command, which…
-
Unable to solve .inp file using pymapdl
Hi, I am trying to access a mechanical model and change the co-eff of friction for contact. But while doing so I am not able to solve the .inp file which I created from mechanical. Can anyone help me with this. The error says "SOLVE is not a recognized BEGIN command" My code is as below: from ansys.mapdl.core import…
-
How to use libGLTFWriter.lib static c++ library in python to create .avz file ?
I have integrated the Ansys Viewer into one of the Ansys web application, and it is using OptisLang as a flagship product. Now I have FMOP data to visualize my CAD file in the Python 3D viewer, but I want to visualize it in the Ansys viewer. As Statics of Structure (OptisLang tool) does not have the facility to convert…
-
Modify multiple node positions in PyMAPDL
Hi, I need to modify multiple node positions for a particular model. For this currently, I'm using the command mapdl.n() (also tried mapdl.ngen()) in a loop. This works fine but takes a longer time appx. 70 seconds (since the number of nodes to be modified is large). Whereas when I perform the same task through…
-
How can I using scripting get displacements as function of time at certain areas ?
We have a named selection in a mechanical transient (structural) system and we want to write all of the displacement for every time step to a text file for further post processing. How can we do that using mechanical scripting?
-
How can add certain results and group them
How can I with mechanical scripting add say stress and displacement results into a folder group?
-
How can I get the centroid of a surface in Spaceclaim?
How can I get the centroid of a surface and show it in a dialogue box?
-
How can I create Groups inside SC from selected faces that are obtained by the small faces tool
How can I create a Group/Named Selection inside SC from selected faces that are obtained by the small faces tool?
-
DPF Error: The Label Space Request in this collection has more than one entry
I am currently working with a model that has a "surface coating" applied in Mechanical and trying to pull results using the DPF. Essentially it appears the DPF is pulling two different element shapes from my selected mesh ids (most likely both the 3D elements on the part and the 2D shells created by the surface coating).…
-
DPF Install issue
I used the Ansys Python Manager to download python and relevant libraries. When I do that and then try to run dpf in with the following command from ansys.dpf import core as dpf in Jupyter notebook I get the following error. `---------------------------------------------------------------------------AttributeError…
-
How can I export a GLB / GLTF file format with PyDPF?
How can I export a GLB / GLTF file format with PyDPF?