CommandData not decalred

CommandData not decalred

Anonymous
Not applicable
901 Views
2 Replies
Message 1 of 3

CommandData not decalred

Anonymous
Not applicable

'
' Created by SharpDevelop.
' User: scr4295
' Date: 05/04/2016
' Time: 11:55 AM

' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Imports System
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI.Selection
Imports System.Collections.Generic
Imports System.Linq


<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)> _
<Autodesk.Revit.DB.Macros.AddInId("A4F72B1C-A988-4504-AC48-EEF580842040")> _
Partial Public Class ThisDocument : IExternalCommand
    Private Sub Module_Startup(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Startup
        
   
        
        
    End Sub
     
    Private Sub Module_Shutdown(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Shutdown
  
    End Sub
    
    
    Public Sub File_Name()
        
        TaskDialog.Show ("Hellow World", "My Message to the World")
        
        Dim doc As Document = commandData.Application.ActiveUIDocument.Document
        
     I am getting an error here on commandData like command is not declared, it may be inaccessible due to its protection level.
     can any one tell me where is the mistake.
        
    End Sub
End Class

0 Likes
902 Views
2 Replies
Replies (2)
Message 2 of 3

Mustafa.Salaheldin
Collaborator
Collaborator

Replace this line:

Dim doc As Document = commandData.Application.ActiveUIDocument.Document

with:

Dim doc As Document = Me.Document


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 3 of 3

Charles.Piro
Advisor
Advisor

Hi,

 

CommandData is for ExternalCommand (develop with VisualStudio for exemple).

 

With Macro, use just :

 

For application Macro :

Document doc = ActiveUIDocument.Document;

For Project Macro :

Document doc = Document;

Smiley Wink



PIRO Charles
Developer

PIRO CIE
Linkedin


0 Likes