Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add one part body to another part body from assembly?

0 REPLIES 0
Reply
Message 1 of 1
SELT0001
333 Views, 0 Replies

How to add one part body to another part body from assembly?

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

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report