I want to use a script to select elements by circular selection and write out the result table.
The following is an example in Python script.
This sample creates a mesh group to select elements.
# -*- coding: utf-8 -*-
app = designer.GetApplication()
#Circular Selection Settings
inner = 0 # Inner diameter of circle
outer = 28 # Outer diameter of circle
startAngle = 0 # Start angle
endAngle = 360 # End angle
useheight_flg = 0 # Whether height is used or not (0: no height specified, 1: height specified)
top = 0 # Cylindrical top height
bottom = 0 # Cylindrical bottom height
visible_flg = 0 # Whether the hidden object is also selected or not (0: also select the hidden object, 1: do not select the hidden object)
# The following is obtained by the Point object to set the coordinates.
P1 = app.CreatePoint(0, 0, 0) # Center point of circle (X,Y,Z)
P2 = app.CreatePoint(0, 0, 1) # Center position of axis (X,Y,Z)
P3 = app.CreatePoint(1, 0, 0) # Position of X axis (X,Y,Z)
#Display mesh & select elements
app.View().ShowMesh()
app.View().SelectElement()
# Create dammy mesh groups
app.GetModel(0).GetStudy(0).GetMeshGroupList().CreateElementGroup()
app.GetModel(0).GetStudy(0).GetMeshGroupList().GetMeshGroup(0).SetName(u"dammy")
# Circular selection of elements in the dammy group
P4 = app.GetModel(0).GetStudy(0).GetMeshGroupList().GetMeshGroup(0).GetSelection()
P4.SelectElementByCylinder(P1,P2,P3,inner,outer,startAngle,endAngle,useheight_flg,top,bottom,visible_flg)
# Setting up result tables for output
parameter = app.GetCurrentStudy().CreateTableDefinition()
parameter.SetResultType("MagneticFluxDensity")
parameter.SetCoordinate("Global Rectangular")
parameter.SetComponent("All")
parameter.SetAllSteps()
parameter.SetIsShownMinMaxInfo(True)
parameter.SetIsShownPositionInfo(True)
# Output results to csv with above settings
app.GetCurrentStudy().ExportTable(parameter, u"D:xxx.csv", 0)


