I would lyk to create Derive component from active assembly or active partfile

I would lyk to create Derive component from active assembly or active partfile

k14348
Advocate Advocate
383 Views
1 Reply
Message 1 of 2

I would lyk to create Derive component from active assembly or active partfile

k14348
Advocate
Advocate
Sub CreateDerivedPart()

    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument

    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, "C:\Users\Public\Documents\Autodesk\Inventor 2015\Templates\English\Standard (in).ipt", True)
    
    Dim oPartDef As PartComponentDefinition
    Set oPartDef = oPartDoc.ComponentDefinition
    
    Dim oRefComp As ReferenceComponents
    Set oRefComp = oPartDef.ReferenceComponents
    
    Dim oDerAsmComp As DerivedAssemblyDefinition
    Set oDerAsmComp = oRefComp.DerivedAssemblyComponents.CreateDefinition(oAsmDoc.FullDocumentName)
    
    
    oDerAsmComp.DeriveStyle = kDeriveAsMultipleBodies
    oDerAsmComp.IncludeAllTopLevelWorkFeatures = kDerivedExcludeAll
    oDerAsmComp.IncludeAllTopLevelSketches = kDerivedExcludeAll
    oDerAsmComp.IncludeAllTopLevelParameters = kDerivedExcludeAll
    oDerAsmComp.IncludeAllTopLeveliMateDefinitions = kDerivedExcludeAll
    
    oDerAsmComp.DeriveStyle = kDeriveAsSingleBodyNoSeams
    
    Call oDerAsmComp.SetHolePatchingOptions(kDerivedPatchNone)
    Call oDerAsmComp.SetRemoveByVisibilityOptions(kDerivedRemoveNone)
    
    Dim oDerAsm As DerivedAssemblyComponent
    Set oDerAsm = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerAsmComp)
    
    Call oDerAsm.SuppressLinkToFile
    
End Sub

Please help me to solve error.

 

Thanks

-karthik

0 Likes
384 Views
1 Reply
Reply (1)
Message 2 of 2

HermJan.Otterman
Advisor
Advisor

better remove this one, because it is the same as the other question...

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes