본문 바로가기
Programming/Python & R

Python으로 CST STUDIO SUITE Learning Edition/Student Edition 제어하기 (Controlling CST STUDIO SUITE Learning Edition/Student Edition with Python)

by 도파공 2022. 12. 9.
728x90
반응형

Student Edition이 Learning Edition으로 변경되었다. 이 에디션은 학생뿐만 아니라 개인 학습 목적으로 모든 사람이 사용할 수 있다고 한다. 물론 학습 및 학생용 에디션 라이센스 계약에 따른 상업적 목적은 제외된다. 인터넷이 연결되어 있어야 하고, 이메일 등록 후 사용 가능하다.

The Student Edition has been changed to the Learning Edition. This edition is said to be available to everyone for personal learning purposes, not just students. Of course, commercial use is excluded under the Learning and Student Edition license agreements. It requires an internet connection and email registration.

2022 버전에서 예제들을 실행해 본 결과 모델링 등 사전 작업은 문제 없으나 해석을 했을 때 메쉬 또는 솔버  오류가 발생하고 있다. 2021 버전은 문제 없이 동작하는 것은 확인되었으니 당분간은 2021 버전을 받아 연습해 보기 바란다. 이 문제는 나의 경우에 한정될 수 있기 때문에 먼저 확인 바란다. 나의 경우 아직 2022 버전 오류가 있는데, 해결방법을 빨리 찾았으면 한다.

When I ran the examples in 2022, the preliminary work such as modeling was fine, but when I ran the analysis, mesh or solver errors occurred. The 2021 version is working fine, so for the time being, please get the 2021 version and practice. This issue may be specific to your case, so please check first. I still have the 2022 version error and hope to find a solution soon.

Learning Edition 또는 Student Edition은 기본적으로 스크립트를 지원하지 않는다. 다만 python의 win32com을 이용하면 사용이 가능하다는 것을 확인할 수 있다. 아래에 재질 추가 및 변수 추가하는 내용이 포함된 간단한 사용 예를 남긴다.

The Learning Edition or Student Edition does not support scripts by default. However, you can use python's win32com to verify that they can be used. Below is a simple usage example that includes adding a material and adding a variable.

import time
import sys

from win32com import client

# CST STUDIO SUITE 시작
oCSTApp = client.Dispatch("CSTStudio.Application")

# new EMS Project
oProject = oCSTApp.NewEMS()

# Save Path & File Name for Project
pName = "C:/Works/Simulia/example.cst"

oProject._FlagAsMethod("SaveAs")
oProject.SaveAs(pName,'False')

# Add Variable
ss_x = 10
oProject._FlagAsMethod("StoreParameter")
oProject.StoreParameter("ss_x", str(ss_x))

# Add New Material
setMaterialFerrite = """
With Material 
     .Reset 
     .Name "Ferrite"
     .Folder ""
     .Rho "0.0"
     .ThermalType "Normal"
     .ThermalConductivity "0"
     .SpecificHeat "0", "J/K/kg"
     .DynamicViscosity "0"
     .Emissivity "0"
     .MetabolicRate "0.0"
     .VoxelConvection "0.0"
     .BloodFlow "0"
     .MechanicsType "Unused"
     .FrqType "all"
     .Type "Normal"
     .MaterialUnit "Frequency", "kHz"
     .MaterialUnit "Geometry", "mm"
     .MaterialUnit "Time", "s"
     .MaterialUnit "Temperature", "Celsius"
     .Epsilon "1"
     .Mu "3000"
     .Sigma "0"
     .TanD "0.0"
     .TanDFreq "0.0"
     .TanDGiven "False"
     .TanDModel "ConstTanD"
     .EnableUserConstTanDModelOrderEps "False"
     .ConstTanDModelOrderEps "1"
     .SetElParametricConductivity "False"
     .ReferenceCoordSystem "Global"
     .CoordSystemType "Cartesian"
     .SigmaM "0"
     .TanDM "0.0"
     .TanDMFreq "0.0"
     .TanDMGiven "False"
     .TanDMModel "ConstTanD"
     .EnableUserConstTanDModelOrderMu "False"
     .ConstTanDModelOrderMu "1"
     .SetMagParametricConductivity "False"
     .DispModelEps  "None"
     .DispModelMu "None"
     .DispersiveFittingSchemeEps "Nth Order"
     .MaximalOrderNthModelFitEps "10"
     .ErrorLimitNthModelFitEps "0.1"
     .UseOnlyDataInSimFreqRangeNthModelEps "False"
     .DispersiveFittingSchemeMu "Nth Order"
     .MaximalOrderNthModelFitMu "10"
     .ErrorLimitNthModelFitMu "0.1"
     .UseOnlyDataInSimFreqRangeNthModelMu "False"
     .UseGeneralDispersionEps "False"
     .UseGeneralDispersionMu "False"
     .NLAnisotropy "False"
     .NLAStackingFactor "1"
     .NLADirectionX "1"
     .NLADirectionY "0"
     .NLADirectionZ "0"
     .Colour "0", "1", "1" 
     .Wireframe "False" 
     .Reflection "False" 
     .Allowoutline "True" 
     .Transparentoutline "False" 
     .Transparency "0" 
     .Create
End With
"""
oProject._FlagAsMethod("AddToHistory")
oProject.AddToHistory("define material", setMaterialFerrite)

oProject._FlagAsMethod("Save")
oProject.Save()

스크립트를 실행한 결과 CST Studio Suite에서 EM Studio가 잘 실행되고 동작된 것을 확인 할 수 있다.

After running the script, you can see that EM Studio is up and running in CST Studio Suite.

저장도 문제 없이 잘 된다.

Saving also works fine.

메쉬 수 제약이 있기 때문에 복잡한 구조를 해석할 수는 없다. 아래 캡쳐 이미지에 나타난 기준으로 가능한 범위를 알 수 있으니 참고 바랍니다.

Due to the mesh count limitations, it is not possible to analyze complex structures. To give you an idea of the range of possibilities, you can use the captured image below as a guide.

728x90
반응형

댓글