GetNastranEntityParams() iLogic API は、Nastran エンティティ パラメータ(エンティティのジオメトリ ID、ジオメトリ タイプ、およびコンポーネント名)を取得します。
GetNastranEntityParams ([ReferenceKey] String 型, [GeometryID] Integer 型, [GeometryType] Integer 型, [ComponentName] StringBuilder 型)
| 名前 | 型 | 説明 |
|---|---|---|
| ReferenceKey | String | エンティティの参照キーの文字列形式を指定する入力パラメータです。参照キーの取得に使用するキー コンテキストは、GetContextID() Inventor Nastran iLogic API から取得します。 |
| GeometryID | Integer | エンティティのジオメトリ ID を指定する出力パラメータです。 |
| GeometryType | Integer | エンティティのジオメトリ タイプを指定する出力パラメータです。 |
| ComponentName | StringBuilder | エンティティのコンポーネント名を指定する出力パラメータです。 |
AddReference "NINIlogic"
Public Module Module1
Public Dim AddinObj As New NINIlogic.InCadAddin
Public Dim strKey As String
End Module
Sub Main()
' Get Geom ID, Geom Type & Component Name from key
Dim iRet, iGeomID, iGeomType As Integer
Dim strCompName As New System.Text.StringBuilder(512)
strKey = ""
GetBRepRefKeys()
msg = MsgBox("calling GetNEEntityParams", vbOKOnly, "API call")
iRet = AddinObj.GetNastranEntityParams(strKey, iGeomID, iGeomType, strCompName)
sMsg = "GeomID = " & iGeomID
MessageBox.Show(sMsg)
sMsg = "GeomType = " & iGeomType
MessageBox.Show(sMsg)
sMsg = "strCompName = " & strCompName.ToString
MessageBox.Show(sMsg)
iLogicVb.UpdateWhenDone = True
End Sub
Sub GetBRepRefKeys()
' Get the active document.
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oSelectSet As SelectSet
oSelectSet = oDoc.SelectSet
If oSelectSet.Count = 0 Then
msg = MsgBox("Please select an entity (face/edge/vertex) & re-run the rule.", vbOKOnly, "Select entity")
Return
' Check to make sure a single item was selected.
ElseIf oSelectSet.Count <> 1 Then
msg = MsgBox("Please select only 1 entity (face/edge/vertex) & re-run the rule.", vbOKOnly, "Invalid selection")
Return
End If
Dim oFace As Face
Dim oEdge As Edge
Dim oVertex As Vertex
Dim i As Integer
' if face was selected
If TypeOf oSelectSet.Item(1) Is Face Then
' Set a reference to the selected face.
msg = MsgBox("Face selected", vbOKOnly, "Selected entity")
oFace = oSelectSet.Item(1)
i = 0
' if edge was selected
ElseIf TypeOf oSelectSet.Item(1) Is Edge Then
' Set a reference to the selected edge.
msg = MsgBox("Edge selected", vbOKOnly, "Selected entity")
oEdge = oSelectSet.Item(1)
i = 1
' if vertex was selected
ElseIf TypeOf oSelectSet.Item(1) Is Vertex Then
' Set a reference to the selected vertex.
msg = MsgBox("Vertex selected", vbOKOnly, "Selected entity")
oVertex = oSelectSet.Item(1)
i = 2
End If
' Set a reference to the ReferenceKeyManager object.
Dim refKeyMgr As ReferenceKeyManager
refKeyMgr = oDoc.ReferenceKeyManager
Dim entityRefKey(-1) As Byte
Dim keyContext As Long
' Get key context.
'keyContext = refKeyMgr.CreateKeyContext
isValid = AddinObj.GetContextID(keyContext)
If (Not isValid)
msg = MsgBox("Invalid Context", vbOKOnly, "Context validation")
Return
End If
' Get reference keys from the selected entities.
If (i = 0)
oFace.GetReferenceKey(entityRefKey, keyContext)
Else If (i = 1)
oEdge.GetReferenceKey(entityRefKey, keyContext)
Else If (i = 2)
oVertex.GetReferenceKey(entityRefKey, keyContext)
End If
strKey = refKeyMgr.KeyToString(entityRefKey)
msg = MsgBox(strKey, vbOKOnly, "Ref-Key array")
End Sub
サンプル パート
Nastran エンティティ パラメータをクエリーするキー コンテキストを取得するためのサンプル スクリプトは、ダウンロード可能な IPT ファイルに含まれています。次のリンクをクリックしてダウンロードしてください: https://knowledge.autodesk.com/ja/support/inventor-nastran/troubleshooting/caas/downloads/downloads/JPN/content/post-ilogic-test-modelipt-for-customer-download.html