Community
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.
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