티스토리 뷰

MIDAS NX API

[MIDAS NX API] Load case 생성하기

마구자바 2025. 7. 1. 17:19
반응형


엑셀 VBA에서

 

NX API를 이용하여, Load Case 생성하기.

 

Main 함수에서 아래와 같이 생성할 load case들을 배열로 설정하고, 

 

NX_LOADCASE_Add 라는 서브함수를 이용해서 load case가 자동으로 생성되도록 구현하였다.

 

    ' 로드케이스 생성
    '
    aLCase = Array( _
                        Array("DC", "USER"), _
                        Array("DW", "USER"), _
                        Array("LL1", "USER"), _
                        Array("LL2", "USER"), _
                        Array("LL3", "USER"), _
                        Array("WL1", "USER"), _
                        Array("WL2", "USER"), _
                        Array("WS11", "USER"), _
                        Array("WS12", "USER"), _
                        Array("WS21", "USER"), _
                        Array("WS22", "USER"), _
                        Array("TU11", "USER"), _
                        Array("TU12", "USER"), _
                        Array("TU21", "USER"), _
                        Array("TU22", "USER"), _
                        Array("EQ11", "USER"), _
                        Array("EQ12", "USER"), _
                        Array("EQ21", "USER"), _
                        Array("EQ22", "USER") _
                    )
    
    Call NX_LOADCASE_Add(aLCase)

 

 

"NX_LOADCASE_Add" 서브함수

 

Function NX_LOADCASE_Add(aLCase)

Dim i As Integer

Dim sResp As String
Dim sWebReq As String

Dim dicMain As Scripting.Dictionary
Dim dicSub1 As Scripting.Dictionary
Dim dicSub2 As Scripting.Dictionary

    Set dicMain = New Dictionary
    Set dicSub1 = New Dictionary
        
     'construction load case
For i = 0 To UBound(aLCase)
    
    Set dicSub2 = New Dictionary
    
    dicSub2.Add "NAME", UCase(aLCase(i)(0))
    dicSub2.Add "TYPE", UCase(aLCase(i)(1))
    
    dicSub1.Add i + 1, dicSub2
    
    Set dicSub2 = Nothing

Next i


dicMain.Add "Assign", dicSub1

sWebReq = JsonConverter.ConvertToJson(dicMain)
sResp = WebRequest("POST", "/db/STLD", sWebReq)

Set dicSub1 = Nothing
Set dicMain = Nothing

End Function

 

 

 

 

반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31