Problem calling Revit Document

Problem calling Revit Document

Anonymous
Not applicable
397 Views
2 Replies
Message 1 of 3

Problem calling Revit Document

Anonymous
Not applicable

Hi,

Calling a form from class library. Error with rvtDoc and selSet.

 

Imports System
Imports Autodesk
Imports Autodesk.Revit
Imports System.Windows.Forms.Application
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI


Public Class AnForm
    Inherits System.Windows.Forms.Form
    Implements Revit.IExternalCommand
    Public elem As Element

 

 Public Function GetParent(ByVal application As Creation.Application, ByRef message As String, ByVal elements As ElementSet) As Result Implements Revit.IExternalCommand.Execute

        '  get hold of a revit document.
        '
        Dim rvtDoc As Document = application.ActiveDocument

        '  get a list of selected elements.
        '
        Dim selSet As ElementSet = rvtDoc.Selection.Elements

        '  how many did you get?

 

Thank you,

Bob V

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

augusto.goncalves
Alumni
Alumni

Sorry I never saw that GetParent implementation for IExternalCommand, only the default Execute method. Pretty sure this is not possible...

 

Revit requires that the plug-in contains the Execute method on the class, and that is the entry point. From there you can call any form.

 

Hope this make sense...

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 3 of 3

Anonymous
Not applicable

I think it was in Revit 2008 that I first created this addin. I created a form in Vb.net and called it in Revit api using External Tools. It allowed me to select objects and get and change parameters. I am calling the form AnForm from a class but I get errors with rvtDoc. Enrolled in a C# class for the fall so the tutorials and webcast will be easier to understand.

 

Thank you

Bob v

0 Likes