Imports System
Imports System.Collections.Generic
Imports System.Linq
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
Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult
i have problem here , Please can you tell me what is the problem.
Statment is not valid in the Namespace.
Thanks
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
End Function
Imports System
Imports System.Collections.Generic
Imports System.Linq
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
Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult
i have problem here , Please can you tell me what is the problem.
Statment is not valid in the Namespace.
Thanks
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
End Function
The code you posted does not have a namespace.
Imports System Imports System.Collections.Generic Imports System.Linq 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 YourProject Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult 'your code goes here. End Function End Namespace
The code you posted does not have a namespace.
Imports System Imports System.Collections.Generic Imports System.Linq 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 YourProject Public Function Execute(ByVal commandData As ExternalCommandData, ByVal message As ref, ByVal elements As ElementSet) As CmdResult 'your code goes here. End Function End Namespace
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
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
Please work through the Revit API getting started material, especially the DevTV and My First Revit Plugin tutorials:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Then all will become clear.
Have fun!
Best regards,
Jeremy
Please work through the Revit API getting started material, especially the DevTV and My First Revit Plugin tutorials:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#2
Then all will become clear.
Have fun!
Best regards,
Jeremy
I am not so much experts in this still learning, but i need this API please can you correct and Send me, Thanks
I am not so much experts in this still learning, but i need this API please can you correct and Send me, Thanks
Can't find what you're looking for? Ask the community or share your knowledge.