본문 바로가기
Programming/Macro(Excel, Google Sheets)

Excel VBA로 CST STUDIO SUITE Learning Edition/Student Edition 제어하기 (Control CST STUDIO SUITE Learning Edition/Student Edition with Excel VBA)

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

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

The Student Edition has been changed to the Learning Edition, which is said to be available to everyone for personal study purposes, not just students. Of course, commercial purposes are excluded under the Learning and Student Edition license agreement. It requires an internet connection and is available after email registration.

다만 2022 버전에서 예제들을 실행해 본 결과 솔버 및 메쉬 에러가 발생하고 있습니다. 2021 버전은 문제 없이 동작하는 것은 확인되었으니 당분간은 2021 버전을 받아 연습해 보세요.

However, we've been running examples on the 2022 version and are getting solver and mesh errors. We've found that the 2021 version works fine, so for the time being, get the 2021 version and practice with it.

Learning Edition 또는 Student Edition은 기본적으로 스크립트를 지원하지 않는다. 다만 Excel VBA ActiveX 컨트롤러를 이용하면 사용이 가능하다는 것을 확인할 수 있어요. 아래에 재질 추가 및 변수 추가하는 내용이 포함되어 간단한 사용 예를 남깁니다.

The Learning Edition or Student Edition does not support scripts by default. However, you can use the Excel VBA ActiveX Controller to demonstrate that it can be used. Below is a simple example of how to use it, including adding a material and adding a variable.

Sub Main()

    Dim studio As Object
    Set studio = CreateObject("CSTStudio.Application") 'OLE 객체 연결 명령
    
    Dim ems As Object 'ems object 명령
    Set ems = studio.NewEMS
    
    ' 저장경로 + 저장파일
    ems.SaveAs "C:\Works\Simulia\2021\exam_vba.cst", False
    
    ' Set Solver Type
    Dim setSolver As String
    setSolver = "ChangeSolverType ""LF Frequency Domain"""
    
    ems.AddToHistory "change solver type", setSolver
    
    Dim path As String
    Dim fname As String
    path = ActiveWorkbook.path 'script가 있는 path를 가져오는 명령
       
    Dim tmp As Range 'history를 작성하기 위한 tmp 변수 지정
    Set tmp = Sheet1.Range("B2")
    
    ems.AddToHistory "define units", tmp
    
    ems.SaveAs "C:\Works\Simulia\2021\exam_vba.cst", True
    
    ems.Quit
    studio.Quit

End Sub

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

After running the script, I was able to confirm that EM Studio was up and running in CST Studio Suite.

저장도 문제 없이 잘 되었습니다.

Saving also went well.

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

We can't interpret complex structures, but the criteria shown in the capture image below gives you an idea of the possible range.

728x90
반응형

댓글