TAGGED: macros-scripting, spaceclaim
-
-
November 11, 2021 at 9:50 pmFirasBejarSubscriber
Hello,
I have a file "file.py" that contains simple commands that I want to execute from vscode without opening spaceclaim itself.
How can I achieve this?
Also, I noticed that commands like numpy are not define within spaceclaim, is there a way to import them?
Thank you,
November 26, 2021 at 1:19 pmAniketForum ModeratorCan you please check if the following helps:
ANSYS ACT External Libraries NumPy SciPy Matplotlib XLRD PPTX .. - YouTube
-Aniket
How to access Ansys help links
Guidelines for Posting on Ansys Learning Forum
October 30, 2023 at 10:44 pmmjmiddleAnsys EmployeeMost Ansys products use IronPython for scripting. Mechanical has a beta option to use CPython in the scripting console. You can use other python variants externally. Given the title of your post, you can launch any python variant, or for that matter any script interpreter (Tcl, Perl, sh, bat, etc...), and do what you can there then have that script launch SpaceClaim:
"C:\Program Files\ANSYS Inc\v232\scdm\SpaceClaim.exe" /Welcome=False /Splash=False /RunScript="D:\my_path\my_script.py" /ExitAfterScript=True /Headless=True
The my_script.py will have to be an IronPython script through. Your external script interpreter could even write this script.
Once inside SpaceClaim or Mechanical, they could also take this external approach to write a data file, then run a system command (python exec()) to launch any of script interpreter and read the data file. This is the approach taken in the link of Aniket's post. It uses an ACT extension, but you could also launch an external program in Mechanical using a "Python Code" or "Python Result" or even an APDL command snippet (/SYS command).Â
October 30, 2023 at 10:49 pmmjmiddleAnsys EmployeeSince IronPython use .Net Framework it does not support a lot of CPython modules. An alternative is to use MathNet library (http://numerics.mathdotnet.com/). You can download the library yourself, but Ansys has distributed it inside the Ansys installation. Here is how you can access it with IronPython:
import os
import clr
clr.AddReference("Ans.Utilities")
version = Ansys.Utilities.ApplicationConfiguration.DefaultConfiguration.VersionInfo.VersionString
sys.path.append(os.environ["AWP_ROOT" + version] + "\\Addins\\ACT\\bin\\Win64")
clr.AddReferenceToFile("MathNet.Numerics.dll")
import MathNet.NumericsViewing 3 reply threads- The topic ‘How to run a Spaceclaim script from an external IDE like vscode?’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Unable to attach geometry 2024 R2
- DXF file loaded incorrectly
- plugin error failed to import assembly from spaceclaim
- Overlapping contact face
- Thermoelectric Cooler Model
- Issue Seeing Explore
- Inventor 2025 files
- SpaceClaim stops sharing topology
- Ansys SpaceClaim and Discovery 2024 Facet shelling bug – 2022 version is better
- solidwork parameters for optimization in ansys
Top Contributors-
1727
-
630
-
599
-
591
-
366
Top Rated Tags© 2025 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.
-