Duplicates the material
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Syntax
C# |
---|
public Material Duplicate(
string name
) |
Visual Basic |
---|
Public Function Duplicate ( _
name As String _
) As Material |
Visual C++ |
---|
public:
Material^ Duplicate(
String^ name
) |
Parameters
- name
- Type: System..::..String
Name of the new material - this name must be correctly structured for Revit use and not duplicate the name
of another material in the document.
Return Value
The new material.
Remarks
Examples
CopyC#
private bool DuplicateMaterial(Material material)
{
bool duplicated = false;
string newName = "new" + material.Name;
Material myMaterial = material.Duplicate(newName);
if (null == myMaterial)
{
TaskDialog.Show("Revit", "Failed to duplicate a material!");
}
else
{
duplicated = true;
}
return duplicated;
}
CopyVB.NET
Private Function DuplicateMaterial(material As Material) As Boolean
Dim duplicated As Boolean = False
Dim newName As String = "new" & Convert.ToString(material.Name)
Dim myMaterial As Material = material.Duplicate(newName)
If myMaterial Is Nothing Then
TaskDialog.Show("Revit", "Failed to duplicate a material!")
Else
duplicated = True
End If
Return duplicated
End Function
Exceptions
See Also