
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to get my code to mirror parts that are located in an assembly about the assembly planes. I have tried both derived parts and direct mirror feature and gotten them to work, just not the way I want them to . So I got this piece of code (located below) from this site and modified it a bit to select an item from my assembly. I want to mirror the part about the assembly planes, I've tried calling the planes from the assembly and use it as an input at various locations without success. I've tried to modify the individual items of the assembly plane object to be identical to the part planes (but they are read only). I've tried creating planes through other means but they are all in the local coordinate system of the part I'm about to mirror. I can supply the coordinates and rotation to get the local plane aligned with the assembly planes since I used that information before to place the member but I really don't want to do all that cross referencing.
Can you show me the way to use the assembly plane as in input argument for the mirror? (oAssemblyPlane does not work as an argument in the add procedure)
Sub MirrorMirrorOnTheWall() Dim oAssemblyDoc As AssemblyDocument Set oAssemblyDoc = ThisApplication.ActiveDocument Dim oAssemblyPlane As WorkPlane Set oAssemblyPlane = oAssemblyDoc.ComponentDefinition.WorkPlanes(2) ' Get the part document. Dim partDoc As PartDocument Set partDoc = ThisApplication.Documents.Item(16) 'Get the part component definition Dim oPartDef As PartComponentDefinition Set oPartDef = partDoc.ComponentDefinition ' Get the X-Z-Plane work plane. Dim oxzPlane As WorkPlane Set oxzPlane = oPartDef.WorkPlanes.Item(2) 'Get the Z-Axis Dim ozAxis As WorkAxis Set ozAxis = oPartDef.WorkAxes.Item(3) Dim oPlane4 As WorkPlane Set oPlane4 = oPartDef.WorkPlanes.AddByLinePlaneAndAngle(ozAxis, oxzPlane, 0) 'Turn off the visibility of the mirror plane oPlane4.Visible = False 'Get the object collection Dim oCol As ObjectCollection Set oCol = ThisApplication.TransientObjects.CreateObjectCollection Call oCol.add(partDoc.ComponentDefinition.SurfaceBodies(1)) 'Mirror the feature Dim oMirror As MirrorFeature Set oMirror = partDoc.ComponentDefinition.Features.MirrorFeatures.add(oCol, oPlane4, False) 'This can be activated if the mirrored feature is to be a new solid oMirror.NewBodyOperation = True End Sub
Solved! Go to Solution.