Change Naming Category of Assembly by Dynamo

Hi All,

How to change Naming Category of Assembly using dynamo.

Please suggest me

Thanks in advanced

Hi @robert12546358,

Please read this first. How to get help on the Dynamo forums

-biboy

I tried but is not working, get error The parameter’s storage type is not a string.

hi @robert12546358,

I just have a short question.
Does all your assemblies contain object with Walls category?

-biboy

Yes, wall is including in assembly.

hi @robert12546358,

try this: change_assembly_name.dyn (7.9 KB)
just change the second Category to any category you want but it should exist in your assemblies.

it should look like this:
3

python script:

import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager


doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

elements = UnwrapElement(IN[0])
for el in elements:
	param = el.LookupParameter(IN[2])
	param.Set(UnwrapElement(IN[1]).Id)

TransactionManager.Instance.TransactionTaskDone()

OUT = elements

cheers!

-biboy

it’s get a error & result is null.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 18, in
EnvironmentError: System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at Element.setParameterValue(Element* , ElementId , ParameterValue* )
at Autodesk.Revit.DB.Parameter.Set(ElementId value)
at Microsoft.Scripting.Interpreter.FuncCallInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at Microsoft.Scripting.Interpreter.DynamicInstruction4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at DSIronPython.IronPythonEvaluator.EvaluateIronPythonScript(String code, IList bindingNames, IList bindingValues)

hi @robert12546358

since it is error, it should be null. did you restart your revit? also if possible, can you share a sample file.

-biboy

I share sample file.

hi @robert12546358,

my script run well in your file, please check:

your file (changed parameter value):

dynamo:

-biboy

Yes, it’s working in new dynamo file.
Thank you so much. :grinning: :grinning: :+1: :+1: