티스토리 뷰
반응형
엑셀 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
반응형
'MIDAS NX API' 카테고리의 다른 글
[MIDAS NX API] Node 추가하기 (0) | 2025.07.01 |
---|---|
[MIDAS NX API] 재료물성 추가하기 (0) | 2025.07.01 |
[MIDAS NX API] 단위계 Unit 설정 (0) | 2025.07.01 |
[MIDAS NX API] 총 요소수 노드수 확인하기 (0) | 2025.06.26 |
[MIDAS NX API] Element 생성 (0) | 2025.06.26 |
댓글