CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[ANSYS Meshing] Named Selection Script

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Skadi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2021, 15:19
Default Named Selection Script
  #1
New Member
 
Ali
Join Date: Aug 2021
Posts: 4
Rep Power: 5
Skadi is on a distinguished road
Hi Everybody
I'm new to Ansys Scripting.
I'm working on Mechanical Model environment. I've created named selection using worksheet as following code.
Code:
# Name Selection Body
sel = Model.AddNamedSelection()
sel.ScopingMethod=GeometryDefineByType.Worksheet
sel.Name = "Oil"
OilC = sel.GenerationCriteria
OilC.Add(None)
OilC[0].EntityType=SelectionType.GeoBody
OilC[0].Criterion=SelectionCriterionType.Name
OilC[0].Operator=SelectionOperatorType.Equal
OilC[0].Value="FVe"
OilC.Add(None)
OilC[1].EntityType=SelectionType.GeoBody
OilC[1].Criterion=SelectionCriterionType.Name
OilC[1].Operator=SelectionOperatorType.Equal
OilC[1].Value="Core"
OilC.Add(None)
OilC[2].EntityType=SelectionType.GeoBody
OilC[2].Criterion=SelectionCriterionType.Name
OilC[2].Operator=SelectionOperatorType.Equal
OilC[2].Value="Box"
sel.Generate()
Now I want to use the created group in mesh sizing But I don't know how.

Code:
msh = Model.Mesh
m_1 = msh.AddSizing()
m_1.Location  =  "select Name selection Parts Code"
There is an option for selecting geometry by named selection



thanks in advance for your Help and time.
Skadi is offline   Reply With Quote

Old   September 12, 2021, 16:08
Default Named Selection Script
  #2
New Member
 
Ali
Join Date: Aug 2021
Posts: 4
Rep Power: 5
Skadi is on a distinguished road
I finally found the code thanks to this website

for whom are interested in scripting

Code:
msh = Model.Mesh
Named_selections = DataModel.GetObjectsByName("NAME") #get name selection by its name
m_6 = msh.AddSizing()
m_6.Location = Named_selections[0] #choose The location
m_6.ElementSize = Quantity(str(18)+"[mm]")
arsenis likes this.
Skadi is offline   Reply With Quote

Reply

Tags
ansys, mesh, python, scripts


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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 06:37
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
[DesignModeler] Script create Named Selection and Suppress arpeedesign ANSYS Meshing & Geometry 0 July 7, 2016 04:25
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 12:39
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 15:53.