CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

Mesh slected Areas using Python-script?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2020, 08:11
Default Mesh slected Areas using Python-script?
  #1
New Member
 
Join Date: Jul 2020
Posts: 3
Rep Power: 6
StrawHat is on a distinguished road
Dear Community,

iīm new to Ansa Scripting (Python) and need to find a way that meshes selected Areas seperatly on a whole model - in this Case for example a part from a motorengine.
after running the existing Batch mesher, there are a lot of small areas that should be finer-meshed. To Avoid, that our engineers have to spent one whole day to mesh them finer manually, we Need a script.
The idea is, that the user can select some Areas and the script is meshing them finer without changing the non-selected Areas.
It would be great if the user is able to set the Parameters by himself (ex: if there is an angle of 90 Degree, he wants 3 rows)
Unfortunetly i didnīt find a solution anywhere.
Thankīs a lot for your help in Advance!
StrawHat is offline   Reply With Quote

Old   July 8, 2020, 03:54
Default
  #2
Member
 
Maries
Join Date: Mar 2010
Location: Coimbatore, India
Posts: 76
Rep Power: 16
rmaries is on a distinguished road
Hi,
There is no need of python script for this. Batchmesher is itself capable of doing this.
In the batch mesher parameter setting use the feature handler option and set right row numbers based on your fillet radius. I remember there is a tutorial for batch meshing in ansa tutorial folder. You can refer that for further info

Best Regards
Maries
rmaries is offline   Reply With Quote

Old   July 8, 2020, 04:33
Default
  #3
New Member
 
Join Date: Jul 2020
Posts: 3
Rep Power: 6
StrawHat is on a distinguished road
Quote:
Originally Posted by rmaries View Post
Hi,
There is no need of python script for this. Batchmesher is itself capable of doing this.
In the batch mesher parameter setting use the feature handler option and set right row numbers based on your fillet radius. I remember there is a tutorial for batch meshing in ansa tutorial folder. You can refer that for further info

Best Regards
Maries

Hi Maries,

Yes we are using it Right now and most of the time it does itīs Job well but on some Areas not, thats why we Need to mesh them manually or run a script for a finer mesh on the selected Areas.
Is there a better solution?
Thanks in Advance!
StrawHat is offline   Reply With Quote

Old   July 8, 2020, 06:57
Default
  #4
Member
 
Maries
Join Date: Mar 2010
Location: Coimbatore, India
Posts: 76
Rep Power: 16
rmaries is on a distinguished road
Yes that is possible.

Code:
IsolateRadius,     BETA PYTHON development Manual
NAME:
IsolateRadius - Isolates all the faces based on a given radius limit.

SYNOPSIS:
ansa.base.IsolateRadius(radius)   Named Arguments

DESCRIPTION:
This function isolates on the screen all the faces based on a given radius limit.
Arguments

radius  float     The radius limit to isolate the faces.
This command will isolate the surfaces with required radius in screen. Collect that face and apply the required meshing parameter.
rmaries is offline   Reply With Quote

Old   July 10, 2020, 05:36
Question
  #5
New Member
 
Join Date: Jul 2020
Posts: 3
Rep Power: 6
StrawHat is on a distinguished road
Thanks for your help!

is it also possible to mesh selected Fillets ?

For now, iīm using this code:

Quote:
def get_selected_Fillet_id():
print("please select Faces")
base.SetPickMethod(base.constants.ENT_SELECTION)
collected_entities = base.PickEntities(DECK, "FILLET")
#collected_type = type(collected_entities)
for entity in collected_entities:
return entity

The result is like :
Quote:
2201 3520 <Entity: 0x000001F302B92DC0: type: 3520(3520,FILLET_ENTITY) id:2201>
<class 'list'>

The entitiy._id is equal to the id of the selected Fillet in the Feature Manager.
How can i change Values here or mesh them seperatly by using an other mesh-param-file?
StrawHat is offline   Reply With Quote

Old   August 20, 2020, 01:05
Default
  #6
New Member
 
RAJALINGAM MANICKAM
Join Date: Mar 2018
Location: Hyderabad
Posts: 3
Rep Power: 8
MRAJALIN is on a distinguished road
Hi,

You can add collected fillet faces to the batch mesh scenario by using below API,

for this you have to save one separate meshing scenario.

SYNOPSIS:
ansa.batchmesh.AddPartToMeshingScenario(INPUT_ref, SCENARIO_ref)

DESCRIPTION:
This function adds an item or an array of items (part, group, property or volume) to a batch mesh scenario.

ARGUMENTS:
[required] INPUT_ref object References the item to be added to the senario. The type of the item may be a part, group,
property or volume.
[required] SCENARIO_ref object References the senario. The senario's type must be in accordance to the type of the item.



Regards,
Rajalingam. M

Last edited by MRAJALIN; August 20, 2020 at 02:12.
MRAJALIN is offline   Reply With Quote

Old   November 2, 2020, 11:59
Default Similar issue with scripting
  #7
New Member
 
Michael
Join Date: Nov 2020
Posts: 1
Rep Power: 0
MikeMart is on a distinguished road
Hello every one,

I am encountering a problem very similar to yours. In order to automate a rather long process, I'm scripting the generation of layers on Ansa. However, I'm encountering a problem, and I'm afraid it will be difficult to solve, as I have the impression that some functions are missing in Ansa scripting...

My problem is the following: I want to assign different names to my layers from a python script using ansa scripting, and these layers must be in the same layers generation session because they share common boundaries, so I can't put them in separate sessions, otherwise they don't connect properly when building layers.

So I want to:

- Create a session: batchmesh.GetNewLayersSession()
- Add the PID I want to mesh: batchmesh.AddPartToSession()
- Read a parameter map: batchmesh.ReadSessionMeshParams()
- Create a certain number of Area: batchmesh.GetNewLayersArea(name_area)
- Add some PIDs from my session to these areas. This is the blocking point, there is no function for that... Has anyone ever had the problem?

Thank you so much,
Regards,
Michael
MikeMart is offline   Reply With Quote

Old   December 16, 2020, 12:09
Default
  #8
New Member
 
Join Date: May 2014
Posts: 21
Rep Power: 12
greg.cfd is on a distinguished road
@MikeMart:


Indeed such a function does not exist. As a workaround you could create a filter specifically for this layers area using AddFilterToSession. This function can be used for sessions and layer areas as well. Then apply the filters using DistributeAllItemsToScenarios.


For example if you have a pointer to the layers area (it is returned by the GetNewLayerArea function) named area1, you can use:


Code:
batchmesh.AddFilterToSession('Name', 'equals', 'SHELL_PROPERTY', area1, 'all', 'no', 'layer_area_filter_1')
batchmesh.DistributeAllItemsToScenarios()
The above will create a filter named 'layer_area_filter_1' with the expression Name = SHELL_PROPERTY, as defined by the first 3 argumeents of the function.


Regarding layers areas, these are entities of type: 'BATCH_MESH_LAYERS_AREA'. You can use this keyword to collect them (CollectEntities).


@StrawHat:
You could also delete the mesh from just the faces you wish to refine and then re-run your batch mesh with the option "Freeze existing mesh".
greg.cfd is offline   Reply With Quote

Reply

Tags
ansa meshing, ansa scripting


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] Export fluent mesh via script Nigirim ANSYS Meshing & Geometry 10 March 24, 2022 06:00
[OpenFOAM] Using python script for automatic post processing of openFoam vPaquet ParaView 12 December 16, 2021 04:30
[snappyHexMesh] Snappyhex mesh: poor inlet mesh Swagga5aur OpenFOAM Meshing & Mesh Conversion 1 December 3, 2016 17:59
Star CCM Overset Mesh Error (Rotating Turbine) thezack Siemens 7 October 12, 2016 12:14
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 04:33.