In this article, we will use Assembly Mates to assemble the pipe vice attached.
Step 1: Main Screw
To begin, we fix the Support and add the first ConcentricMate between it and the Main Screw. For each Mate, we identify the defining faces and, for each face, its corresponding chain of parents.
ReadFile rs = new ReadFile("pipe_vice.eye");
rs.DoWork();
rs.AddTo(design1);
BlockReference supportBlockRef = (BlockReference)design1.Entities[0];
supportBlockRef.IsFixed = true;
Brep support = (Brep)supportBlockRef.GetEntities(design1.Blocks)[0];
BlockReference mainScrewBlockRef = (BlockReference) design1.Entities[1];
Brep mainScrew = (Brep) mainScrewBlockRef.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(
support.Faces[21], new Stack<BlockReference>(new[] { supportBlockRef }),
mainScrew.Faces[1], new Stack<BlockReference>(new[] { mainScrewBlockRef }),
true
);
Step 2: Jaw
Next, we add three different Mates to attach the Jaw to the Main Screw. The two components are aligned using a ConcentricMate, while a CoincidentMate ensures that the top plane of the Jaw is in contact with the end of the Main Screw. Finally, a ParallelMate is added between the Support and the Jaw.
BlockReference jawBlockRef = (BlockReference)design1.Entities[2];
Brep jaw = (Brep)jawBlockRef.GetEntities(design1.Blocks)[0];
design1.RootBlock.AddConcentricMate(
mainScrew.Faces[1], new Stack<BlockReference>(new[] { mainScrewBlockRef }),
jaw.Faces[35], new Stack<BlockReference>(new[] { jawBlockRef }),
true
);
design1.RootBlock.AddCoincidentMate(
mainScrew.Faces[5], new Stack<BlockReference>(new[] { mainScrewBlockRef }),
jaw.Faces[42], new Stack<BlockReference>(new[] { jawBlockRef })
);
design1.RootBlock.AddParallelMate(
support.Faces[6], new Stack<BlockReference>(new[] { supportBlockRef }),
jaw.Faces[39], new Stack<BlockReference>(new[] { jawBlockRef })
);
Step 3: Handle
Similarly, for the Handle, we add a ConcentricMate and a CoincidentMate on the Bar for each of the two Screws.
BlockReference handleBlockRef = (BlockReference) design1.Entities[3];
Block handleBlock = design1.Blocks[handleBlockRef.BlockName];
BlockReference barBlockRef = (BlockReference) handleBlock.Entities[0];
barBlockRef.IsFixed = true;
Brep bar = (Brep) barBlockRef.GetEntities(design1.Blocks)[0];
BlockReference screwBlockRef1 = (BlockReference) handleBlock.Entities[1];
Brep screw = (Brep) screwBlockRef1.GetEntities(design1.Blocks)[0];
BlockReference screwBlockRef2 = (BlockReference) handleBlock.Entities[2];
handleBlock.AddConcentricMate(
bar.Faces[4], new Stack<BlockReference>(new[] { barBlockRef }),
screw.Faces[5], new Stack<BlockReference>(new[] { screwBlockRef1 })
);
handleBlock.AddConcentricMate(
bar.Faces[4], new Stack<BlockReference>(new[] { barBlockRef }),
screw.Faces[5], new Stack<BlockReference>(new[] { screwBlockRef2 }),
true
);
handleBlock.AddCoincidentMate(
bar.Faces[3], new Stack<BlockReference>(new[] { barBlockRef }),
screw.Faces[1], new Stack<BlockReference>(new[] { screwBlockRef1 })
);
handleBlock.AddCoincidentMate(
bar.Faces[6], new Stack<BlockReference>(new[] { barBlockRef }),
screw.Faces[1], new Stack<BlockReference>(new[] { screwBlockRef2 })
);
barBlockRef.IsFixed = false;
Step 4: Mounting the Handle
Finally, we assemble the Handle. A ConcentricMate and a DistanceMate will suffice to keep the Handle in place with the two Screws equidistant from the center of the Main Screw. It is important to note that for these two Mates, as they involve nested BlockReferences, the full hierarchy relative to the current block (in this case, the RootBlock) must be specified.
design1.RootBlock.AddConcentricMate(
bar.Faces[4], new Stack<BlockReference>(new[] { handleBlockRef, barBlockRef }),
mainScrew.Faces[0], new Stack<BlockReference>(new[] { mainScrewBlockRef }),
true
);
design1.RootBlock.AddDistanceMate(
mainScrew.Faces[1], new Stack<BlockReference>(new[] { mainScrewBlockRef }),
screw.Faces[1], new Stack<BlockReference>(new[] { handleBlockRef, screwBlockRef1 }),
65,
true
);
Comments
Wow! Assembly mates with mechanisms ๐
Please sign in to leave a comment.