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

[Workbench] Automating worksheet of named selections in Ansys Workbench

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2017, 19:16
Lightbulb Automating worksheet of named selections in Ansys Workbench
  #1
New Member
 
benjamin cosatto
Join Date: Feb 2017
Location: France
Posts: 2
Rep Power: 0
Ben_15 is on a distinguished road
Hi everyone,


I would like to create an automatic named selection with Jscript code in Ansys Workbench.


My idea was to use a worksheet as scoping method for named selection (with different criteria). However I have some problem with the code.


I don’t know how to write in my code the selection of different criteria (Action, GeometryType, Operator, Value …) and the application of “a filter” (Body, Face, Vertex … for GeometryType / Equal, NotEqual, Less Than … for Operator …) which are in the worksheet.


When I tried something like the code below, I have an error message: Error 800A01C2 - Wrong number of arguments of invalid property assignment.


name = "Selection_1"
NS = DS.Script.addNamedSelection(false,name,DS.Script.i d_NS_Body);
DS.Script.changeActiveObject(NS.ID)
ListView.ActivateItem("Scoping Method");
ListView.ItemValue = "Worksheet";
NS.AddCriteriaData();

Someone have an idea ?



In my opinion, I don’t have the good parameters in “addnamedselection()” but I don’t know how to do.


Thank you for your help.
Ben
Ben_15 is offline   Reply With Quote

Old   October 4, 2017, 06:00
Default
  #2
New Member
 
LLORIA
Join Date: Aug 2017
Posts: 4
Rep Power: 4
LLORIA is on a distinguished road
Hi here is your answer :

named_sel=ExtAPI.DataModel.Project.Model.AddNamedS election()
named_sel.SendToSolver=0
named_sel.Location=ExtAPI.SelectionManager.CreateS electionInfo(SelectionTypeEnum.WorksheetSpecific)
named_sel_WS=named_sel.Location
named_sel.Name="Target_Faces_mesh_sizing_sym_entry _holes"

named_sel_WS.AddRow()
named_sel_WS.SetAction(0,NamedSelectionWorksheetAc tion.Add)
named_sel_WS.SetEntityType(0,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(0,NamedSelectionWorkshee tCriterion.Location_Y) #NamedSelection Location_X
named_sel_WS.SetOperator(0,NamedSelectionWorksheet Operator.GreaterThan) #Largest Smallest Equal NotEqual LessThan GreaterThan Equal
named_sel_WS.SetValue(0,0.245)

named_sel_WS.AddRow()
named_sel_WS.SetAction(1,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(1,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(1,NamedSelectionWorkshee tCriterion.Location_Y) #NamedSelection Location_X
named_sel_WS.SetOperator(1,NamedSelectionWorksheet Operator.LessThan) #Largest Smallest Equal NotEqual LessThan GreaterThan Equal
named_sel_WS.SetValue(1,0.278)

named_sel_WS.AddRow()
named_sel_WS.SetAction(2,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(2,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(2,NamedSelectionWorkshee tCriterion.Size)
named_sel_WS.SetOperator(2,NamedSelectionWorksheet Operator.LessThan)
named_sel_WS.SetValue(2,0.00290)

named_sel_WS.AddRow()
named_sel_WS.SetAction(3,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(3,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(3,NamedSelectionWorkshee tCriterion.Size)
named_sel_WS.SetOperator(3,NamedSelectionWorksheet Operator.GreaterThan)
named_sel_WS.SetValue(3,0.00280)
named_sel_WS.Generate()
LLORIA is offline   Reply With Quote

Old   March 9, 2019, 10:14
Default Automatic selection script gives the error.... Help Please
  #3
New Member
 
Danish
Join Date: Jan 2012
Posts: 4
Rep Power: 10
danishrehman is on a distinguished road
Hello experts,
I am trying to access the named selection automation script given by LLORIA but when I run it in ANSYS MESH, it mentions the error shown in the picture. I want to create 100s of named selection (faces/volumes) to assign boundary conditions systematically. Thanks for your help in advance.




Quote:
Originally Posted by LLORIA View Post
Hi here is your answer :

named_sel=ExtAPI.DataModel.Project.Model.AddNamedS election()
named_sel.SendToSolver=0
named_sel.Location=ExtAPI.SelectionManager.CreateS electionInfo(SelectionTypeEnum.WorksheetSpecific)
named_sel_WS=named_sel.Location
named_sel.Name="Target_Faces_mesh_sizing_sym_entry _holes"

named_sel_WS.AddRow()
named_sel_WS.SetAction(0,NamedSelectionWorksheetAc tion.Add)
named_sel_WS.SetEntityType(0,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(0,NamedSelectionWorkshee tCriterion.Location_Y) #NamedSelection Location_X
named_sel_WS.SetOperator(0,NamedSelectionWorksheet Operator.GreaterThan) #Largest Smallest Equal NotEqual LessThan GreaterThan Equal
named_sel_WS.SetValue(0,0.245)

named_sel_WS.AddRow()
named_sel_WS.SetAction(1,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(1,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(1,NamedSelectionWorkshee tCriterion.Location_Y) #NamedSelection Location_X
named_sel_WS.SetOperator(1,NamedSelectionWorksheet Operator.LessThan) #Largest Smallest Equal NotEqual LessThan GreaterThan Equal
named_sel_WS.SetValue(1,0.278)

named_sel_WS.AddRow()
named_sel_WS.SetAction(2,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(2,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(2,NamedSelectionWorkshee tCriterion.Size)
named_sel_WS.SetOperator(2,NamedSelectionWorksheet Operator.LessThan)
named_sel_WS.SetValue(2,0.00290)

named_sel_WS.AddRow()
named_sel_WS.SetAction(3,NamedSelectionWorksheetAc tion.Filter)
named_sel_WS.SetEntityType(3,NamedSelectionWorkshe etEntityType.Face)
named_sel_WS.SetCriterion(3,NamedSelectionWorkshee tCriterion.Size)
named_sel_WS.SetOperator(3,NamedSelectionWorksheet Operator.GreaterThan)
named_sel_WS.SetValue(3,0.00280)
named_sel_WS.Generate()
danishrehman is offline   Reply With Quote

Old   March 12, 2019, 03:31
Default
  #4
Member
 
Baris PULAT
Join Date: Sep 2016
Location: Italy
Posts: 59
Rep Power: 5
bpulat is on a distinguished road
I am not an expert in ANSYS ACT but the script originally posted by LLORIA looks to be an ACT code.
Therefore, it is not going to work with ANSYS run macro utility which uses JScript.
bpulat is offline   Reply With Quote

Reply

Tags
namedselection, scripting, worksheet

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
only 1 of many named selections not showing up in cfx pre mihirbhagat CFX 2 April 26, 2019 04:56
Can you help me with a problem in ansys static structural solver? sourabh.porwal Structural Mechanics 0 March 27, 2016 17:07
2way FSI with Ansys workbench lingdeer ANSYS 3 May 9, 2013 03:48
Gambit vs. Ansys workbench mesh generating sanlee39 Main CFD Forum 2 April 8, 2013 06:09
[ANSYS Meshing] Missing Named Selections kschong ANSYS Meshing & Geometry 3 June 4, 2012 04:04


All times are GMT -4. The time now is 21:35.