Hello Guys,
In examples I found sample code where is shown how to split 1st part body by 2nd part body if they are in assembly. My task is inverse. I need to join 1st part body with 2nd part body. In Samples I found code where two part bodies are join as TransientBreps and new body is writen to 3rd part file. For me is important this Join to have as feature in 1st part body. So I wrote such code:
Sub DoJoin() Dim oAsmDoc As AssemblyDocument Set oAsmDoc = ThisApplication.ActiveDocument Dim oOcc1 As ComponentOccurrence Set oOcc1 = oAsmDoc.ComponentDefinition.Occurrences(1) Dim oOcc2 As ComponentOccurrence Set oOcc2 = oAsmDoc.ComponentDefinition.Occurrences(2) Dim oPartDoc As PartDocument Dim oPartDef As PartComponentDefinition Set oPartDoc = oOcc2.Definition.Document Set oPartDef = oPartDoc.ComponentDefinition Dim oTransientBRep As TransientBRep Set oTransientBRep = ThisApplication.TransientBRep Dim oBody1 As SurfaceBody Set oBody1 = oTransientBRep.Copy(oOcc1.Definition.SurfaceBodies(1)) Call oTransientBRep.Transform(oBody1, oOcc1.Transformation) Dim oMatrix2 As Matrix Set oMatrix2 = oOcc2.Transformation oMatrix2.Invert Call oTransientBRep.Transform(oBody1, oMatrix2) Call oPartDef.Features.NonParametricBaseFeatures.Add(oBody1) End Sub
Finaly I got a WorkSurface in 1st part. But I would like to have Solid2 not a surface. How I can convert that Surface to Solid. After it I can apply CombineFeature to Join them to one solid. If this feature is to be associative it would be very nice.
I tried implement KnitFeature for converting Surface to Solid, but I don't be success.
Might be you have another suggestion?
Best regards,
Saulius