Dear All,
I am getting run-time error while running the attached code.
Following are the version details.
AECOsim SS6 Version 08.11.09.829
Full code is attached. it will be a great help if someone can assist me.
Option Explicit Public Sub UpdateParts() Dim partRefNode As TFPartRefList Dim oEnumerator As ElementEnumerator Dim oFamily As String Dim oPart As String Dim oNewFamily As String Dim oNewPart As String Dim oNewLayer As String Dim oNewColor As Integer oFamily = "A1010" oPart = "A1012_WALL" oNewFamily = "A1010" oNewPart = "A1012_BEAM" oNewLayer = "New Layer" oNewColor = 6 Set oEnumerator = ActiveModelReference.GetSelectedElements Do While oEnumerator.MoveNext MsgBox "Type: " & oEnumerator.Current.Type Dim elm As TFElement Dim elmNode As New TFElementList Dim formRecipeList As TFFormRecipeList Dim formRecipe As TFFormRecipe Dim oElement As Element elmNode.InitFromElement oEnumerator.Current Set elm = elmNode Dim eFamily As String Dim ePart As String Dim ePartRefList As TFPartRefList Dim ePartList As TFPartList Set ePartRefList = elm.GetPartRef If Not ePartRefList Is Nothing Then Dim ePartRef As TFPartRef Set ePartRef = ePartRefList If ePartRef.IsResolvable Then ePartRef.GetPart ePartList ePartList.AsTFPart.GetFamilyName eFamily ePartList.AsTFPart.GetName ePart If eFamily = oFamily And ePart = oPart Then 'Old part and new specified Family+Part are the same ePartRef.SetPartName oNewPart elm.SetPartRef ePartRef If elm.GetIsFormType() Then elm.GetFormRecipeList formRecipeList Set formRecipe = formRecipeList.AsTFFormRecipe'formRecipe.SetLevel oNewLayer'formRecipe.SetColor oColor TFApplication.ModelReferenceRewriteFormRecipe ActiveModelReference, formRecipe TFApplication.ModelReferenceRewriteFormRecipeList ActiveModelReference, formRecipeList Else elm.GetElement oElement'Set oElement.Level = oNewLayer'oElement.Color = oColor oElement.Rewrite End If End If End If End If Loop TFApplication.SynchronizePartUI True End Sub