ANSA Scripting Examples For Beginners
Ansa scripting | Hello friends, once again I come up with some more basic ansa scripts which will be helpful for you to understand ansa scripting logic. I hope, you already go through my past post where I have mentioned their script. without wastage of time let's start.
Basic ANSA script No. 4
If you want to highlight or delete the face which is under 5 mm area or as per your specified values of the area.
Might be this question has generated in your mind, but why? Why we should use this script?
Sometimes while we going through shell meshing or plastic meshing. first, we have to generate mid surface & due to complexity, it generates small faces. These faces are too tiny. human eyes unable to detect it or work with it properly.
This work is tedious & time-consuming. This issue has frequently seen in complex plastic meshing.
At the same, you can use the following script to resolve or save time & reduce complexity in the work panel temporarily.
The script is available in pink color :
import ansa
from ansa import *
total_faces=base.CollectEntities(constants.LSDYNA, None, "FACE", False, True)
for each_face in total_faces:
area=base.GetFaceArea(each_face)
small_faces=[]
faces_area=[]
if area <10 :
faces_area.append(area)
small_faces.append(each_face)
print(small_faces)
base.DeleteFaces(small_faces)
# you can only highlight the faces which are under the 10 mm
If you have any doubts or reverse questions, don't be hesitate to comment. I am a student & want your favor in the sense of some new ideas.
Basic ANSA script No. 5
If you want to check which are the faces do not mesh & still have pending to mesh. for this, you can go through the following command. which is very helpful in especially plastic meshing or complex zone.
print(mesh.UnmeshedMacros())
Conclusion:
I introduced an effective example of ansa scripting in geometry clean-up work. I hope you have a background in python programming & understand the importance of programming/scripting. In the upcoming post, I will use data science - python libraries to explore LSDYNA output files like glstat, nodout, matsum, etc.
Thank you for your attention.
#ansa scripting
#ansa automation
#data science in finite element analysis
.
Nice..one should read all these to gain knowledge in automation..very good scripted .good going.all the best
ReplyDelete