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: 

Associative Representation in Substitute with vba

0 REPLIES 0
Reply
Message 1 of 1
graitec7
358 Views, 0 Replies

Associative Representation in Substitute with vba

I have a code  that creates a substitute and set it in a LoD.

It works great but I don't now, how the code is, to set the "Associative" in Representations.

When I create the substitute manually "Associative" is set.

Can anyone help me?

Sorry for my bad English.

 

Derived Assembly.jpg

 

Private Sub EO_BG_Click()

    ' Set a reference to the active assembly document
    Dim oDoc As AssemblyDocument
    Set oDoc = ThisApplication.ActiveDocument

    Dim oDef As AssemblyComponentDefinition
    Set oDef = oDoc.ComponentDefinition

    ' Create a new part document that will be the shrinkwrap substitute (kPartDocumentObject)
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, "R:\Vorlagen\2013\Template\Norm.ipt", False)

    Dim oPartDef As PartComponentDefinition
    Set oPartDef = oPartDoc.ComponentDefinition

    Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
    Set oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(oDoc.FullDocumentName)
        
    ' Set various related options
    oDerivedAssemblyDef.DeriveStyle = kDeriveAsMultipleBodies
    oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = kDerivedIncludeAll
    oDerivedAssemblyDef.IncludeAllTopLevelSketches = kDerivedIncludeAll
    'oDerivedAssemblyDef.ReducedMemoryMode = True
    oDerivedAssemblyDef.RemoveInternalVoids = True
    
    oDerivedAssemblyDef.ActiveDesignViewRepresentation = "Vorgabe"
    Call oDerivedAssemblyDef.SetHolePatchingOptions(kDerivedPatchAll)

    'options:
    'kDeriveAsSingleBodyWithSeams
    'kDeriveAsSingleBodyNoSeams
    'kDeriveAsMultipleBodies
    'kDeriveAsWorkSurface

    ' Create the shrinkwrap component
    Dim oDerivedAssembly As DerivedAssemblyComponent
    Set oDerivedAssembly = oPartDef.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
    
    oPartDoc.IsSubstitutePart = True ''substitute flag

    ' Save the part
    Dim strSubstituteFileName As String
    strSubstituteFileName = Left$(oDoc.FullFileName, Len(oDoc.FullFileName) - 4)
    strSubstituteFileName = strSubstituteFileName & "_EO_BG.ipt"

    ThisApplication.SilentOperation = True
    Call oPartDoc.SaveAs(strSubstituteFileName, False)
    ThisApplication.SilentOperation = False

    ' Create a substitute level of detail using the shrinkwrap part.
    Dim oSubstituteLOD As LevelOfDetailRepresentation
    Set oSubstituteLOD = oDef.RepresentationsManager.LevelOfDetailRepresentations.AddSubstitute(strSubstituteFileName)
    oSubstituteLOD.Name = "EO_BG"
    
    ' Release reference of the invisibly opened part document.
    oPartDoc.ReleaseReference
    
    End

End Sub

 

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