Tagged: act, application, scripting, spaceclaim, workbench
July 20, 2021 at 9:05 amBJMELSubscriber
I'm having difficulties implementing my previously developed SpaceClaim script, into an ACT scripting environment. I want to roll out this script solution out to my colleagues, as this design/analysis is quite repetitive and I thought an ACT (APP) would be quite suitable for the task.
The SpaceClaim script works perfectly within the SpaceClaim scripting environment. I've modified the IronPython SpaceClaim script slightly to work better with ACT by:
- Splitting it into two .py files, the script and the definition (def) I've defined
- Modified the input geometry variables to extract the values from the user (see example below)
So far I've achieved the following in ACT:
- Defining the steps
- Setting up the workbench interface (separate load cases)
- Opening SpaceClaim
- Defining the geometry input
- Extracting the geometrical values from 4., to be used further in the IronPython code.
After that the ACT program crashes on a line where I define:
variable = Direction.Create(1,0,0)
variable = List[IComponent]()
My conclusion is therefore that: ACT does not recognize the internal SpaceClaim IronPython functions as default.
I've tried to define the following default definition that "imports" the default SpaceClaim IronPython definitions. ACT can call and run the definition , but it doesn't work.....
This function imports SpaceClaim scripting for ACT
from SpaceClaim.Api.V19 import Geometry
from SpaceClaim.Api.V19 import Modeler
I've searched for days for some kind of solution online and in the ANSYS guides, but I cannot find my way around this problem. Do any of you have any suggestions?
Note: I cannot share the source code as it owned by the company I work for, but I can share some of if it would helpJuly 27, 2021 at 12:54 pmrmeenaAnsys EmployeeHello
The SpaceClaim scripting function can not be used in ACT app without importing the spaceclaim libraries.
I would recommend you to first of all use ACT console in SpaceClaim for developing/Testing the code. Please refer to the help manual to check the parent libraries to be imported for a function (C:\Program Files\ANSYS Inc\v211\scdm\SpaceClaim.Api.V19).
For example, to use Direction.Create(0,0,1) you can simply search for this function in the help manual to find that you would need SpaceClaim.Api.V19.Geometry to be imported.
SpaceClaim.Api.V19.Geometry as geometry
geometry.Direction.Create(0,0,1) #Create a direction object
Similarly, List is nothing but a .Net array of type System.Collections.Generic.List.
Hope it helps.
July 27, 2021 at 8:03 pmBJMELSubscriberGood day Rajesh
After some trial and error, I had stumbled onto this as well, that if I run the code in the ACT console in SpaceClaim I get access to the SC library.
The only problem is that for some reason only V17 of the script library is available in ACT/SpaceClaim, so I need go through my original code and modify it to work with V17.
Do you know why that is? I cannot find anything in the documentation about it.
May 31, 2022 at 7:31 pmtricha122SubscriberBJMEL, did you ever find a solution for API's beyond V17?
i am having similar issues, but related to extensions:
for instance if i have a DesignEdge named "edge" and i want to evaluate its midpoint, i would do so in SC as follows:
px = edge.EvalMid().Point.X
however if i have this in a separate script, and run it using execfile, i will get an error that 'DesignEdgeGeneral' has no attribute 'EvalMid'
If i try to bring in the extensions, it still fails:
px = edge.EvalMid().Point.X
and if i try to name the extensions, doesnt work:
import SpaceClaim.Api.V20.Scripting.Extensions as extension
px = edge.extension.EvalMid().Point.X
I wonder if youve come across a better solution?
Viewing 3 reply threads
Ansys Innovation Space
- 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.Trending discussions
- How to work with STL file?
- Rotate tool in ANSYS Design Modeler
- Using Symmetry in DesignModeler and Expanding the Results
- section plane
- material properties
- ANSYS FLUENT – Operation would result in non manifold bodies
- drawing a geometry by importing a table of points
- Geometry scaling
- Parameters not imported into Workbench 18.2 from Solidworks/Inventor
- Coordinates orientation
Top Rated Tags
© 2023 Copyright ANSYS, Inc. All rights reserved.Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.