Rename Imported CAD Objects ?

Rename Imported CAD Objects ?

s04049
Enthusiast Enthusiast
1,552 Views
5 Replies
Message 1 of 6

Rename Imported CAD Objects ?

s04049
Enthusiast
Enthusiast

How can i Rename the imported CAD Object through the Revit API?1-27-2016 12-54-45 PM.jpg

0 Likes
1,553 Views
5 Replies
Replies (5)
Message 2 of 6

Revitalizer
Advisor
Advisor

Hi,

 

as far as I can see, the ImportInstance's CADLinkType.Name property can be set.

Give it a try.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 6

s04049
Enthusiast
Enthusiast

Hi,

 

CADLinkType.Name only change the Type name of the dwg.(Like the image below)

 

so far i can get the Category of dwg by 

doc.Settings.Categories.get_Item(dwg.name);

but i don't know how to edit it.

1-29-2016 5-18-05 PM.jpg

0 Likes
Message 4 of 6

Anonymous
Not applicable

Hi,

I have the same problem. I can change material but not rename layer. Please let me know

 

[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class ViewCategories : IExternalCommand
{
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
ref string message, ElementSet elements)
{
try
{
UIDocument uidoc = commandData.Application.ActiveUIDocument;

Document doc = uidoc.Document;

View view = doc.ActiveView;

using (Transaction t = new Transaction(doc, "Change Imported dwg visibility"))
{
t.Start();

String prompt = "";

foreach (Category cat in view.Document.Settings.Categories)
{
if (cat.Name.StartsWith("Imported in families"))
{
CategoryNameMap objA = cat.SubCategories;
CategoryNameMapIterator objB = objA.ForwardIterator();
while (objB.MoveNext())
{
Category cat2 = objA.get_Item(objB.Key);
switch (cat2.Name.ToUpper())
{
case "LAYERFOUND":
cat2.Material = getMaterialFromName("NewMaterialName", doc);
break;
default:
break;
}

}

}

}

TaskDialog.Show("Revit", prompt);
t.Commit();


}
}
catch (Exception e)
{
message = e.Message;
return Autodesk.Revit.UI.Result.Failed;
}

return Autodesk.Revit.UI.Result.Succeeded;
}

 

 

0 Likes
Message 5 of 6

info
Explorer
Explorer

Someone can help with this issue?

I have the same problem..

 

Is there any way to rename an imported layer in Revit ?

 

Thanks, Thomas

0 Likes
Message 6 of 6

Ning_Zhou
Advocate
Advocate

hi Revitalizer, are you sure ImportInstance's CADLinkType.Name property can be set?

0 Likes