C#ATIA

↑タイトル詐欺 主にFusion360API 偶にCATIA V5 VBA(絶賛ネタ切れ中)

パラメータの「リンクの結果として」

こちら気になったのでササッと作ってみました。
Copy Parameters from product to part - DASSAULT: CATIA products - Eng-Tips

'catvba
Sub CATMain()

    'copy
    Dim copyDoc As PartDocument
    Set copyDoc = CATIA.Documents.Item("Part1.CATPart")
    
    Dim copySel As selection
    Set copySel = copyDoc.selection
    
    Dim copyParm As Length
    Set copyParm = copyDoc.part.Parameters.Item("length1")
    
    With copySel
        .Clear
        .Add copyParm
        .Copy
    End With
    
    'paste
    Dim pasteDoc As PartDocument
    Set pasteDoc = CATIA.Documents.Item("Part2.CATPart")
    
    Dim pasteSel As selection
    Set pasteSel = copyDoc.selection
    
    With pasteSel
        .Add pasteDoc.part
        .Paste.Special "CATPrtResult"
    End With
    
    pasteDoc.Activate
    
    MsgBox "Done"
    
End Sub

こんな状態のデータで実行。
f:id:kandennti:20191016200518p:plain
あれ? エラーになる。

こちらの手法なのですが...
異なるCATPart間での要素のコピペ - C#ATIA
どうやるのだろう?

そもそも「マクロで」とは記載されていないんですけどね。