import vivid file and rotate

macroに入れて走らせる

vvdをインポートしてファイルネームとentityIDを表示する.

その後-35度傾ける

Sub ImportVVD_rotate()

Dim rf As RFApplication

Dim mdl As RFModel 'shellの集まり

Dim err As RFErrorCode

Dim rfSh As RFShell

Dim strMdl As String

Dim rfDoc As RFDocument 'ファイルをインポートするとき必要

Dim shID() As RFEntityID 'shellとかpointとかにつくID

Dim shCount As Integer

Dim shName As String

Dim shNewName As String

shNewName = "hogehoge"

Set rf = RapidForm.Application

Set rfDoc = rf.Document

Set mdl = rf.model

'''modelの名前を取ってくる

'strMdl = mdl.GetName

'MsgBox (strMdl) 'modelのファイル名がとれる

''' vvdのインポート

err = rfDoc.Import("D:\Data_0.vvd", RF_FILE_VVD)

'''shellのセット

Set rfSh = rf.Shell

shCount = mdl.GetShellCount '登録されているshellの数を取ってくる

ReDim shID(shCount)

mdl.EnumShells shID(0) '意味はわからないが必要.1にするとshID(0)が0に、2にするとshID(0),shID(1)が0になる

'tutorialでは0なので0が無難か

'''entityIDとファイル名の表示

For ii = 0 To shCount - 1 'shCount-1までが有効なIDぽい

rfSh.SetID shID(ii)

rfSh.GetName shName

MsgBox shID(ii) & shName, , ii '第3引数はタイトル

'新しい方から表示される

Next

'''shellのrotate

rfSh.SetID shID(0) '一番新しいshell:インポートしたshell

err = rfSh.SetName(shNewName) 'なぜか表示は変化がない

'MsgBox shName

err = rfSh.Rotate(-35, 0, 0)

rfDoc.RegenShell shID(0)

rfDoc.RedrawScene

End Sub