Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I really can't understand this with Matrix.
In the attached zip you can find a very simple assembly with 3 parts..
But I can't have my copied surfaces to be placed in the right position in my CopyToOcc..
If my CopyToOcc has the same directions as top-assy then it works but not if I turn it..
Is there someone who can tell me how to code this so the surfaces will be placed in the same position and rotations as my occurrences that I copy from.
Regards
Rikard
SyntaxEditor Code Snippet
Dim oAssemblyDef As AssemblyComponentDefinition = oAssemblyDoc.ComponentDefinition Dim CopyToOcc As ComponentOccurrence = Component.InventorComponent("CopyToOcc") Dim CopyToOccDef As PartComponentDefinition = CopyToOcc.Definition Dim CopyFromOcc1 As ComponentOccurrence = Component.InventorComponent("CopyFromOcc1") Dim CopyFromOcc1Def As PartComponentDefinition = CopyFromOcc1.Definition Dim CopyFromOcc2 As ComponentOccurrence = Component.InventorComponent("CopyFromOcc2") Dim CopyFromOcc2Def As PartComponentDefinition = CopyFromOcc2.Definition Dim oSourceBody As SurfaceBody = CopyFromOcc1Def.Worksurfaces.Item(1).Surfacebodies(1) Dim oSourceBody1 As SurfaceBody = CopyFromOcc2Def.Worksurfaces.Item(1).Surfacebodies(1) Dim CopyFromOcc1Matrix As Matrix CopyFromOcc1Matrix = CopyFromOcc1.Transformation Dim CopyFromOcc2Matrix As Matrix CopyFromOcc2Matrix = CopyFromOcc2.Transformation Dim CopyToOccMatrix As Matrix CopyToOccMatrix = CopyToOcc.Transformation CopyToOccMatrix.PreMultiplyBy(CopyFromOcc1Matrix) Dim nonprmFea As NonParametricBaseFeature = CopyToOccDef.Features.NonParametricBaseFeatures.Add(oSourceBody, CopyToOccMatrix) CopyToOccMatrix = Nothing CopyToOccMatrix = CopyToOcc.Transformation CopyToOccMatrix.PreMultiplyBy(CopyFromOcc2Matrix) Dim nonprmFea1 As NonParametricBaseFeature = CopyToOccDef.Features.NonParametricBaseFeatures.Add(oSourceBody1, CopyToOccMatrix) oAssemblyDoc.Update
Solved! Go to Solution.