In this article, we will use Assembly Mates to assemble the connecting rod attached.
Step 1
To begin, we fix the rod and add a ConcentricMate between the rod and the bearing bush. For each mate, we identify the defining faces and, for each face, its corresponding chain of parents. You can identify the index of the defining faces using the PrintFaceIndex() function, shown in the article below.
ReadSTEP rs = new ReadSTEP("CONNECTING ROD ASSLY.STEP");
rs.DoWork();
rs.OpenTo(design1);
BlockReference rodBlockref = (BlockReference)design1.Entities[3];
rodBlockref.IsFixed = true;
BlockReference bbushBlockref = (BlockReference)design1.Entities[5];
Brep rod = (Brep)rodBlockref.GetEntities(design1.Blocks)[0];
Brep bbush = (Brep)bbushBlockref.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(rod.Faces[11], new Stack<BlockReference>(new[] { rodBlockref }),
bbush.Faces[1], new Stack<BlockReference>(new[] {bbushBlockref }), false);Step 2
Next, we add a CoincidentMate between the rod and the bearing bush to fix the bearing bush inside the rod.
design1.RootBlock.AddCoincidentMate(rod.Faces[37], new Stack<BlockReference>(new[] { rodBlockref }),
bbush.Faces[3], new Stack<BlockReference>(new[] { bbushBlockref }), true);Step 3
Next, we add two ConcentricMate between the bearing brass and the rod and two ParallelMate between the bearing brass to align them properly.
BlockReference bearingbrassbr1 = (BlockReference)design1.Entities[1];
BlockReference bearingbrassbr2 = (BlockReference)design1.Entities[8];
Brep bearingbrass = (Brep)bearingbrassbr1.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(rod.Faces[13], new Stack<BlockReference>(new[] { rodBlockref }),
bearingbrass.Faces[2], new Stack<BlockReference>(new[] { bearingbrassbr1 }), false);
design1.RootBlock.AddConcentricMate(rod.Faces[13], new Stack<BlockReference>(new[] { rodBlockref }),
bearingbrass.Faces[2], new Stack<BlockReference>(new[] { bearingbrassbr2 }), true);
design1.RootBlock.AddParallelMate(rod.Faces[25], new Stack<BlockReference>(new[] { rodBlockref }),
bearingbrass.Faces[1], new Stack<BlockReference>(new[] { bearingbrassbr1 }), false);
design1.RootBlock.AddParallelMate(rod.Faces[25], new Stack<BlockReference>(new[] { rodBlockref }),
bearingbrass.Faces[1], new Stack<BlockReference>(new[] { bearingbrassbr2 }), true); Step 4
Next, we add two CoincidentMate to align both bearing brass to the rod.
design1.RootBlock.AddCoincidentMate(bearingbrass.Faces[4], new Stack<BlockReference>(new[] { bearingbrassbr1 }),
bearingbrass.Faces[5], new Stack<BlockReference>(new[] { bearingbrassbr2 }), true);
design1.RootBlock.AddCoincidentMate(rod.Faces[36], new Stack<BlockReference>(new[] { rodBlockref }),
bearingbrass.Faces[4], new Stack<BlockReference>(new[] { bearingbrassbr2 }), true);Step 5
Next, we add a ConcentricMate, a ParallelMate, and a CoincidentMate between the rod and the cap to ensure the last is placed correctly.
BlockReference capbr = (BlockReference)design1.Entities[7];
Brep cap = (Brep)capbr.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(cap.Faces[1], new Stack<BlockReference>(new[] { capbr }),
rod.Faces[42], new Stack<BlockReference>(new[] { rodBlockref }), false);
design1.RootBlock.AddParallelMate(cap.Faces[11], new Stack<BlockReference>(new[] { capbr }),
rod.Faces[24], new Stack<BlockReference>(new[] { rodBlockref }), false);
design1.RootBlock.AddCoincidentMate(cap.Faces[12], new Stack<BlockReference>(new[] { capbr }),
rod.Faces[25], new Stack<BlockReference>(new[] { rodBlockref }), true);Step 6
Next, we add two ConcentricMate between the bolts and the rod and two ConcentricMate between the nuts and the rod to align them correctly.
BlockReference boltbr1 = (BlockReference)design1.Entities[6];
BlockReference boltbr2 = (BlockReference)design1.Entities[4];
BlockReference nutbr1 = (BlockReference)design1.Entities[2];
BlockReference nutbr2 = (BlockReference)design1.Entities[0];
Brep bolt = (Brep)boltbr1.GetEntities(design1.Blocks)[0];
Brep nut = (Brep)nutbr1.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(cap.Faces[1], new Stack<BlockReference>(new[] { capbr }),
bolt.Faces[53], new Stack<BlockReference>(new[] { boltbr1 }), true);
design1.RootBlock.AddConcentricMate(cap.Faces[2], new Stack<BlockReference>(new[] { capbr }),
bolt.Faces[53], new Stack<BlockReference>(new[] { boltbr2 }), true);
design1.RootBlock.AddConcentricMate(cap.Faces[1], new Stack<BlockReference>(new[] { capbr }),
nut.Faces[0], new Stack<BlockReference>(new[] { nutbr1 }), false);
design1.RootBlock.AddConcentricMate(cap.Faces[2], new Stack<BlockReference>(new[] { capbr }),
nut.Faces[0], new Stack<BlockReference>(new[] { nutbr2 }), false); Step 7
Finally, we add four CoincidentMate to fix both bolts and nuts to the cap and the rod.
design1.RootBlock.AddCoincidentMate(rod.Faces[43], new Stack<BlockReference>(new[] { rodBlockref }),
bolt.Faces[55], new Stack<BlockReference>(new[] { boltbr1 }), true);
design1.RootBlock.AddCoincidentMate(rod.Faces[43], new Stack<BlockReference>(new[] { rodBlockref }),
bolt.Faces[55], new Stack<BlockReference>(new[] { boltbr2 }), true);
design1.RootBlock.AddCoincidentMate(cap.Faces[8], new Stack<BlockReference>(new[] { capbr }),
nut.Faces[8], new Stack<BlockReference>(new[] { nutbr1 }), false);
design1.RootBlock.AddCoincidentMate(cap.Faces[8], new Stack<BlockReference>(new[] { capbr }),
nut.Faces[8], new Stack<BlockReference>(new[] { nutbr2 }), false); The following function prints the face indices directly onto the Brep.
protected void PrintFaceIndex(Brep ext)
{
ext.Rebuild();
for (int i = 0; i < ext.Faces.Length; i++)
{
var face = ext.Faces[i];
Surface surface = face.Parametric[0];
Point3D ptParametric = surface.Trimming.ContourList[0].GetIndividualCurves()[0].StartPoint;
Vector3D tan3D = ((TrimCurve)surface.Trimming.ContourList[0].GetIndividualCurves()[0]).Edge.StartTangent;
Point3D pt = surface.PointAt(ptParametric.X, ptParametric.Y);
Vector3D vc = surface.NormalAt(ptParametric.X, ptParametric.Y);
Plane pln = new Plane(pt, tan3D, Vector3D.Cross(vc, tan3D));
Text tx = new Text(pln, new Point2D(1, 1), i.ToString(), 2);
design1.Entities.Add(tx);
}
}
Comments
Please sign in to leave a comment.