Ehsan
2016-04-04, 11:07 AM
i added the namespace even but than even it does not work.
Imports Autodesk.Revit.ApplicationServices
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.DB.Events
Imports Autodesk.Revit.DB.Architecture
Imports Autodesk.Revit.DB.Structure
Imports Autodesk.Revit.DB.Mechanical
Imports Autodesk.Revit.DB.Electrical
Imports Autodesk.Revit.DB.Plumbing
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.UI.Selection
Imports Autodesk.Revit.UI.Events
Imports Autodesk.Revit.Exceptions
Imports Autodesk.Revit.Utility
Imports RvtApplication = Autodesk.Revit.ApplicationServices.Application
Imports RvtDocument = Autodesk.Revit.DB.Document
Namespace Removal
Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult
Dim app As Application = commandData.Application
Dim doc As Document = app.ActiveDocument
Dim e As New Element()
Dim num As Integer = 1
Dim it As ElementIterator = doc.Elements
Do While it.MoveNext()
e = it.Current [as] Element
Try
' get the BuiltInParameter.ALL_MODEL_MARK paremeter.
' If the element does not have this paremeter,
' get_Parameter method returns null:
Dim p As Parameter = e.get_Parameter(BuiltInParameter.ALL_MODEL_MARK)
If p IsNot Nothing Then
' we found an element with the
' BuiltInParameter.ALL_MODEL_MARK
' parameter. Change the value and
' increment our value:
p.Set(num.ToString())
num += 1
End If
Catch ex As Exception
Util.ErrorMsg("Exception: " & ex.Message)
End Try
Loop
doc.EndTransaction()
Return CmdResult.Succeeded
En()
End Function
End Namespace
Imports Autodesk.Revit.ApplicationServices
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.DB.Events
Imports Autodesk.Revit.DB.Architecture
Imports Autodesk.Revit.DB.Structure
Imports Autodesk.Revit.DB.Mechanical
Imports Autodesk.Revit.DB.Electrical
Imports Autodesk.Revit.DB.Plumbing
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.UI.Selection
Imports Autodesk.Revit.UI.Events
Imports Autodesk.Revit.Exceptions
Imports Autodesk.Revit.Utility
Imports RvtApplication = Autodesk.Revit.ApplicationServices.Application
Imports RvtDocument = Autodesk.Revit.DB.Document
Namespace Removal
Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult
Dim app As Application = commandData.Application
Dim doc As Document = app.ActiveDocument
Dim e As New Element()
Dim num As Integer = 1
Dim it As ElementIterator = doc.Elements
Do While it.MoveNext()
e = it.Current [as] Element
Try
' get the BuiltInParameter.ALL_MODEL_MARK paremeter.
' If the element does not have this paremeter,
' get_Parameter method returns null:
Dim p As Parameter = e.get_Parameter(BuiltInParameter.ALL_MODEL_MARK)
If p IsNot Nothing Then
' we found an element with the
' BuiltInParameter.ALL_MODEL_MARK
' parameter. Change the value and
' increment our value:
p.Set(num.ToString())
num += 1
End If
Catch ex As Exception
Util.ErrorMsg("Exception: " & ex.Message)
End Try
Loop
doc.EndTransaction()
Return CmdResult.Succeeded
En()
End Function
End Namespace