Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem calling Revit Document

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
360 Views, 2 Replies

Problem calling Revit Document

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

2 REPLIES 2
Message 2 of 3
augusto.goncalves
in reply to: Anonymous

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
Message 3 of 3
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report