The following is an example of a script for setting concentrated load conditions at nodes on a circle.
import math
# Radius for determining the selection target position
R = 28
# Radial width of the selected area (If set too narrow, nodes may not be selected.)
dR = 0.1
# Initial position angle of the target
Theta_start = 0
# Target's final position angle
Theta_end = 90
# Increment of Selection Angle
Theta_add = 15
# Selection width in the angular direction (If set too narrow, nodes may not be selected.)
dTheta = 0.1
app = designer.GetApplication()
# Switch to mesh display
app.View().ShowMesh()
# Switch to node selection mode
app.View().SelectElementVertex()
# Define a cylinder object to set the specified position of the select circle
cylinder = app.CreateCylinder()
# Set the coordinates of the center point
cylinder.SetCenterPoint(0, 0, 0)
# Set the components of the center axis
cylinder.SetCenterAxis(0, 0, 1)
# Set the direction component of the X-axis
cylinder.SetXAxis(1, 0, 0)
# Set the inner radius of the selected area
cylinder.SetInnerRadius(R - dR/2)
# Set the radius outside the selection area
cylinder.SetOuterRadius(R + dR/2)
# Set whether to specify the height of the selection range
cylinder.SetUseHeight(False)
# Set whether to specify the angle of the selection range
cylinder.SetUseAngle(True)
# Loop within the specified angle range
for theta in range(int(Theta_start), int(Theta_end) + 1, int(Theta_add)):
# Specify the starting angle of the selected range
cylinder.SetStartAngle(theta - dTheta/2)
# Specify the ending angle of the selected range
cylinder.SetEndAngle(theta + dTheta/2)
# Create a node group (group name should be a string indicating the angle)
objNodeGroup = app.GetCurrentStudy().GetMeshGroupList().CreateNodeGroup(f"{theta}deg")
# Remove selection from node group
objNodeGroup.ClearParts()
# Retrieve information about nodes within a node group
sel = objNodeGroup.GetSelection()
# Deselect
sel.Clear()
# Select nodes within the range specified by the cylinder object
sel.SelectNodeByCylinderObject(cylinder, 1)
# Add selected node to group
objNodeGroup.AddSelected(sel)
# Create a concentrated load condition (name the condition with a string indicating the angle)
objCond = app.GetCurrentStudy().CreateCondition("ConcentratedLoad", f"{theta}deg")
# Set the load
objCond.SetValue(u"Load", 1)
# Convert angles from degrees to radians and calculate cosine and sine
direction_x = math.cos(math.radians(theta))
direction_y = math.sin(math.radians(theta))
# Set the load direction along the circumference
objCond.SetXYZPoint(u"Direction", direction_x, direction_y, 0)
# Clear the target to which the condition is applied
objCond.ClearParts()
# Add node group to target
objCond.AddGroup(objNodeGroup, 0)
# Deselect
sel.Clear()


