Autodesk Inventor uses constraints in two primary ways: 2D and 3D sketch constraints control geometry within sketches.
Assembly constraints establish relationships between components in an assembly that control position and behavior.
In this exercise we will be using the invConstraint design to join the legs to the table top. When the kBridge assemblies
show up in Inventor without the use of the invConstraint design, all of the assemblies are centered at the origin. Inventor doesn't
recognize the position rule that kBridge users use to position parts or assemblies.
There are 2 pairs of legs so we need 2 invConstraint designs to position the leg pairs.
Drag the invConstraint design from the Project tree/InventorUtilities/Design folder and drop into the Tables0 design.
In the child tab rename to ConstraintLegPair0 and set the Quantity to 3.
In ConstraintLegPair0/Child Tab/ add these values:
RULE NAME |
TYPE |
DEFAULTS |
CATEGORY |
FLAGS |
---|---|---|---|---|
* invName |
string |
child.refChain.replace(/\./g,"_"); |
Inventor |
Cached Parameter |
invNamedFeature1 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
invNamedFeature2 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
** invOffset |
number |
...See Below... |
Inventor |
Cached Parameter |
invPart1 |
string |
R.rootModel.Tables.Tables0.TableTopGroup.TableTop0.invName |
Inventor |
Cached Parameter |
invPart2 |
string |
R.rootModel.Tables.Tables0.LegPairGroup.LegPair0.invName; |
Inventor |
Cached Parameter |
invSolution |
string |
"Flush" |
Inventor |
Cached Parameter |
treeLabel |
string |
child.invNamedFeature1; |
Assembly |
Cached Parameter |
* invName = | child.refChain.replace(/\./g,"_"); |
//This formula creates a unique name for each child. |
** invOffset = | var topThickness = R.rootModel.Tables.Tables0.Thickness; |
var topLength = R.rootModel.Tables.Tables0.length; |
var topWidth = R.rootModel.Tables.Tables0.width ; |
var legThickness = R.rootModel.Tables.Tables0.Thickness; |
var tableHeight = R.rootModel.Tables.Tables0.height; |
var OffsetXY = -(tableHeight/2 - topThickness/2)* 2.54 ; |
var OffsetXZ = (topWidth/2 - legThickness/2) * 2.54; |
var OffsetYZ = (topLength/2 - legThickness/2) * 2.54; |
return [OffsetXY, -OffsetXZ,OffsetYZ ][child.index]; |
//The Unit Must Be Centimeter |
// 2.54 centimeters = 1 inch |
There are 2 pairs of legs so we need 2 invConstraint designs to position the leg pairs.
Drag the invConstraint design from the Project tree/InventorUtilities/Design folder and drop into the Tables0 design.
In the child tab rename to ConstraintLegPair1 and set the Quantity to 3.
In ConstraintLegPair1/Child Tab/ add these values:
RULE NAME |
TYPE |
DEFAULTS |
CATEGORY |
FLAGS |
---|---|---|---|---|
* invName |
string |
child.refChain.replace(/\./g,"_"); |
Inventor |
Cached Parameter |
invNamedFeature1 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
invNamedFeature2 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
** invOffset |
number |
...See Below... |
Inventor |
Cached Parameter |
invPart1 |
string |
R.rootModel.Tables.Tables0.TableTopGroup.TableTop0.invName |
Inventor |
Cached Parameter |
invPart2 |
string |
R.rootModel.Tables.Tables0.LegPairGroup.LegPair1.invName; |
Inventor |
Cached Parameter |
invSolution |
string |
"Flush" |
Inventor |
Cached Parameter |
treeLabel |
string |
child.invNamedFeature1; |
Assembly |
Cached Parameter |
* invName = | child.refChain.replace(/\./g,"_"); |
//This formula creates a unique name for each child. |
** invOffset = | var topThickness = R.rootModel.Tables.Tables0.Thickness; |
var topLength = R.rootModel.Tables.Tables0.length; |
var topWidth = R.rootModel.Tables.Tables0.width ; |
var legThickness = R.rootModel.Tables.Tables0.Thickness; |
var tableHeight = R.rootModel.Tables.Tables0.height; |
var OffsetXY = -(tableHeight/2 - topThickness/2)* 2.54 ; |
var OffsetXZ = (topWidth/2 - legThickness/2) * 2.54; |
var OffsetYZ = (topLength/2 - legThickness/2) * 2.54; |
return [OffsetXY, -OffsetXZ,-OffsetYZ ][child.index]; |
// Notice '-OffsetYZ' is in the negative direction. |
The LegPairs have been constrained, now you need to separate the individual legs from one another.
Drag the invConstraint design from the Project tree/InventorUtilities/Design folder and drop into the LegPair0 design.
In the child tab rename to ConstraintLeg and set the Quantity to 3.
In ConstraintLeg/Child Tab/ add these values:
RULE NAME |
TYPE |
DEFAULTS |
CATEGORY |
FLAGS |
---|---|---|---|---|
* invName |
string |
child.refChain.replace(/\./g,"_"); |
Inventor |
Cached Parameter |
invNamedFeature1 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
invNamedFeature2 |
string |
["XY Plane","XZ Plane","YZ Plane"][child.index] |
Inventor |
Cached Parameter |
** invOffset |
number |
...See Below... |
Inventor |
Cached Parameter |
invPart1 |
string |
this.LegGroup.Leg0.invName; |
Inventor |
Cached Parameter |
invPart2 |
string |
this.LegGroup.Leg1.invName; |
Inventor |
Cached Parameter |
invSolution |
string |
"Flush" |
Inventor |
Cached Parameter |
treeLabel |
string |
child.invNamedFeature1; |
Assembly |
Cached Parameter |
* invName = | child.refChain.replace(/\./g,"_"); |
//This formula creates a unique name for each child. |
** invOffset = | var topWidth = R.rootModel.Tables.Tables0.width ; |
var legThickness = R.rootModel.Tables.Tables0.Thickness; |
var OffsetXY = 0; |
var OffsetXZ = (topWidth-legThickness) * 2.54; |
var OffsetYZ = 0; |
return [OffsetXY, OffsetXZ,OffsetYZ ][child.index]; |
//The Unit Must Be Centimeter |
// 2.54 centimeters = 1 inch |