Ansys Learning Forum › Forums › Discuss Simulation › 3D Design › Driving parameter and script parameter › Reply To: Driving parameter and script parameter
Thank you very much indeed for your reply.
I want to make cylinders in a slot box and move these geometry a certain height.
I want to calculate these geomery change effect by optiSLang.
So I want to set 3 parameters, circle radius, Block_height, Block_Width. All three parameters should be in parmeter set.
There is no problem to make circles and extrude them by parametric radius which located in Block_Width x Block_Lenght(15999mm, constant).
But the Block_Width cannot be define in script parameters. I think it is driving parameters.
Because the number of circles are determined by the area of Block_Width x BlockLength, it is impotant to set Block_Width as parameter which I want to use in parameter set in Workbench.
And I move these whole set of cyliners in slot(Block_WidthxBlockLenght x thickness) into a certain height(Block_Height).
Unfortunately “move” geometry in SpaceClaim cannot be a driving parameters.
And driving parameters only can be parameter set in DX or optiSLang, isn’t it true?
Help in SpaceClaim don’t help me. SpaceClaim Script document doesn’t decribe script parameter in detail.
Where can I find proper document except this Forum?
——————————————————————————————————————
# Python Script, API Version = V23
# Library import
import math
Block_radius=Parameters.Block_radius
B_W=Parameters.Block_Width
B_H=Parameters.Block_Height
B_M=12.0 /1000.0 # margine
B_W=400.0/1000-2*B_M # Width of Rectangle
B_L=1599.0/1000.0-2*B_M # Length of Rectangle
thickness=6.0/1000 # extrude thickness of circle (or the depth of slot)
r=Block_radius # radius of perforate plate holes
print(B_M)
print(B_W)
print(B_L)
print(r)
print(thickness)
# making circle surface
circular_radius = MM(r)*1000.00
circle_pitch = MM(r) * 3 * 1000.00
print (circular_radius)
print (circle_pitch)
# start location of circle surface
start_x = -B_W/2+circle_pitch/2
print(start_x)
start_y = 93939.0/1000.0
print(start_y)
start_z = -B_L/2+circle_pitch/2
print(start_z)
# number of circle
num_circles_x=int(math.ceil(B_W/circle_pitch))
num_circles_z=int(math.ceil(B_L/circle_pitch))
print(num_circles_x)
print(num_circles_z)
surfaces=[] # Empty list
for i in range(num_circles_z): # width direction of circle
for j in range(num_circles_x): #length direction of circle
circle_x=start_x + j*circle_pitch
circle_z=start_z + i*circle_pitch
#
if (
circle_x + r > B_W / 2 or
circle_x – r < -B_W / 2 or
circle_z + r > B_L / 2 or
circle_z – r < -B_L / 2 ):
continue
if i%2==1:
circle_x +=circle_pitch/2
circle_result = CircularSurface.Create(r, Direction.DirY,
Point.Create(
circle_x+(13236.0-B_W/2*1000.0-B_M*2*1000)/1000.0,
start_y, circle_z+(9105.0-B_L/2*1000)/1000.0))
if circle_result.Success:
circle_face = circle_result.CreatedBodies[0].Faces[0]
surfaces.append(circle_face)
# Extrude circle surfaces
if surfaces:
selection = Selection.Create(surfaces)
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, thickness, options)
else:
print(“There is no selections”)
Selection.Clear()
ViewHelper.ZoomToEntity()