June 22, 2023 at 6:07 amJinwhanSubscriber
Is there any method to change script parameter as driving parameter in SpaceClaim script? Is parametric study only possible in driving parameters?
I want to use those script parameters in optiSLang. Is there any way to plug optiSLang in to SpaceCalim?
June 22, 2023 at 1:56 pmAniketAnsys Employee
Can you explain the query in more detail? Please note, SpaceClaim rebuilds the model from nothing when replaying scripts and assigns new IDs to all the entities. If you are generating the geometry via script, you should not declare design parameters to individual parts in downstream applications (for example, Mechanical). To properly scope loads and boundary conditions for geometries generated via script, you should generate Named Selections for them in the script itself, and then scope the loads or boundary conditions to the Named Selections downstream.
June 23, 2023 at 3:54 ammjmiddleAnsys Employee
Driving parameters are normally created using Pull and Move tools, but a few tools you can create a driving parameter during just selection mode, such as a pattern. I’m not sure what kind of script parameter you are referring since a script parameter behaves just like a driving parameter made with Pull and Move. You right click on the Groups panel and choose “Create Script Parameter”:
Then right click to “Rename” as you choose:
So if I rename to “myVar1” you can reference it anywhere in your script as “Parameters.myVar1″
This will appear in the workbench project “Parameter Set” as a design parameter exactly as a driving dimension created by Pull and Move. Note that for a script to work with design points, you should “Publish as Group” the script so that it is saved with the SpaceClaim document (*.scdoc):
It will then appear in the Groups tab and be associated with the scdoc file (saved inside the scdoc file):
Note that some good practice in script design is to have a command at the beginning that deletes everything so you know the script started from the same model state each time:
Also, as Aniket mentiond, have your script create named selections at the end since this is the best way to communicate selections in Mechanical for Outline items such as connections, loads, supports, results, etc…
July 5, 2023 at 7:50 amJinwhanSubscriber
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
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
# making circle surface
circular_radius = MM(r)*1000.00
circle_pitch = MM(r) * 3 * 1000.00
# start location of circle surface
start_x = -B_W/2+circle_pitch/2
start_y = 93939.0/1000.0
start_z = -B_L/2+circle_pitch/2
# number of circle
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
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 ):
circle_result = CircularSurface.Create(r, Direction.DirY,
circle_face = circle_result.CreatedBodies.Faces
# Extrude circle surfaces
selection = Selection.Create(surfaces)
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, thickness, options)
print(“There is no selections”)
July 5, 2023 at 11:09 pmmjmiddleAnsys Employee
I don't see a problem here.
A parameter made during the Move tool is a driving parameter as well as the script parameters. So you will have 3 driving parameters. But it is not good practice to make parameters with the native tools such as Move tool and also use script parameters. There may be an unintended result depending on which parameter is updated first. It is better to record the Move tool as script commands, and make another script parameter to use in that code.
Driving parameters can be tagged as optimization parameters in DX. I don't use OptiSlang, but it probably can use the same driving parameters as optimization parameters.
July 7, 2023 at 4:15 amJinwhanSubscriber
Is there any SpaceClaim function to call Driving Dimensions in SpaceClaim script? Script Parameters are easy to use in script but Driving Dimensions are not.
July 7, 2023 at 11:13 pmmjmiddleAnsys Employee
The parameter value in workbench likely not recognize the change to driving dimensions made by script:
dims_NS = Window.Groups.GetValue(Window.ActiveWindow) # gets list of named selections and driving dimensions in Groups tab, not published scripts or script parameters
dims_NS.TryGetDimensionValue() # 1st dimension, 3-tuple type. value is index 1, type is index 2 (Angular, Arc, Area, Diametric, Linear, Mass, Volume
- You must be logged in to reply to this topic.
Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.
Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to work with STL file?
- Rotate tool in ANSYS Design Modeler
- section plane
- Using Symmetry in DesignModeler and Expanding the Results
- ANSYS FLUENT – Operation would result in non manifold bodies
- drawing a geometry by importing a table of points
- material properties
- Coordinates orientation
- “contact pair has no element in it.” how to resolve this problem
- Parameters not imported into Workbench 18.2 from Solidworks/Inventor
© 2023 Copyright ANSYS, Inc. All rights reserved.