2 つのリンクをピンで拘束するには、既知の論理的な方法があるため、リンクが自動的に作成された場合はこの方法が最適です。コンポーネント グループでピンと必要な拘束を収集することで、"スマート" ピン デザインを作成することができます。はじめに、IvComponentGroup に含める新しいデザインを作成します。
デザインに次のパラメータ ルールを追加します。
Design SmartPin : DynamicRuleReactorExampleRoot IvComponentGroup ' the first link part to constrain to the pin Parameter Rule link1 As Part = NoValue ' the second link part to constrain to the pin Parameter Rule link2 As Part = NoValue ' controls the positioning of the pin relative to the links Parameter Rule onRight? As Boolean = True
ここでは、ピンの子ルールと 4 つの拘束を追加します。
Child pin As :IvCylinder diameter = linkHoleDia * 0.95 height = linkThickness * 2.05 End Child Child link1Face As :IvMateConstraint part1 = link1 part2 = pin entity1 = (If onRight? Then "leftFace" Else "rightFace") entity2 = "fBottom" solution = :Flush offset = 0 End Child Child link2Face As :IvMateConstraint part1 = link2 part2 = pin entity1 = (If onRight? Then "rightFace" Else "leftFace") entity2 = "fTop" solution = :Flush offset = 0 End Child Child link1Axis As :IvMateConstraint part1 = link1 part2 = pin entity1 = "hole1Axis" entity2 = "fMain" inferredType2 = :InferredLine End Child Child link2Axis As :IvMateConstraint part1 = link2 part2 = pin entity1 = "hole2Axis" entity2 = "fMain" inferredType2 = :InferredLine End Child
最後に、ピンを区別できるように、displayName ルールを再定義します。
Rule displayName As String ' construct a displayName string in the pattern: ' partName (link1 : link2) Dim result As String = partName result = result & " (" If link1 = NoValue Then result = result & "?" Else result = result & link1.partName End If result = result & " : " If link2 = NoValue Then result = result & "?" Else result = result & link2.partName End If result = result & ")" Return result End Rule
スマート ピンをテストします。ピンとすべての(最初の 2 つの)リンクを削除します。
ここで、SmartPin の子を追加し、パーツ エディタで link_1 と link_2 を選択します。
ブラウザで、SmartPin とともにカスタム表示名が表示されることに注目してください。
このようなスマート ピンを使用すると、高度なレベルの機能モデルに相当する機能が提供されます。1 つのオカレンスと多数の拘束ではなく、1 つのピンを扱うことになります。"ピン" は、必要なすべての "ピンのような" 動作を認識しています。ピンに関連する個々の拘束を削除することはできません。代わりに、ピン全体を削除する必要があります。これにより、そのすべての拘束(または同様の動作)が自動的に対象になります。
<%%categoryOrder ("Inventor Parameters,Inventor"), _ %%OpenCategories ("Inventor Parameters")> _ Design link : DynamicRuleReactorExampleAdoptedComponents linkAdopt Method preCreateSelf() As List Dim result As List result = {{:action, :createDynamicPart, _ :Part, Parent, _ :Name, uniqueName("smartPin"), _ :design, "smartPin", _ :link1, "NoValue", _ :link2, MakeString(partName)}} Return result End Method End Design
動的リンクを追加すると、アタッチされているピンが自動的に取得されます。これで、手動でさきほどのリンクにピンを接続することができます。
次へ: 「動的ルール リアクタを延長する」