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: 

Use a form in Revit API

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
sylvain14d
4780 Views, 5 Replies

Use a form in Revit API

Hi,

 

I'm new in Revit API and i recently realese some simple API.

 

I'm now trying to do an API  which use a forms to ask some parameters value to the user in order to set this parameter value to the selected objects. I created the forms with visual studio.

 

I'm already not able to open the form...

 

This is my part of code called by pressing the button in revit ribbon panel :

 

Public Class CommandHTPOT
    Implements IExternalCommand

    Public Function Execute(
      ByVal commandData As ExternalCommandData,
      ByRef message As String,
      ByVal elements As ElementSet) _
    As Result Implements IExternalCommand.Execute

        Dim uiapp As UIApplication = commandData.Application
        Dim app As Application = uiapp.Application

        Dim windowsform As New Form1()
        Dim result = windowsform.ShowDialog()

    End Function
End Class

My research has so far not helped me... When i execute that code I have a transaction error (French language so can't tell you exactly the terms).

 

 Hoping some help !

 

Thanks a lots

 Sans titre.png

 

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: sylvain14d

Dear Justin,

 

First of all, as a beginner, I strongly recommend that you take a close look at 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

 

That will already answer your question.

 

You can also look at the Revit SDK samples. Several of them display forms as well. 

 

Good luck and have fun!

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
sylvain14d
in reply to: jeremytammik

Hi Jeremy,

Thanks a lot for this good tip ! I already use Revit SDK Sample. I just found information about Taskdialogue... But nothing about a windows form wich would have created with visual studio allowing to get back some informations.

I think that it's not so really complex. Maybe i have an error with this :

<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)>

I do not really know how to go further

Really hoping some help

Best regards,

Sylvain
Message 4 of 6
jeremytammik
in reply to: sylvain14d

Dear Justin,

 

Yes, the automatic transaction mode is deprecated and has been so for a long time:

 

http://thebuildingcoder.typepad.com/blog/2012/12/extra-transaction-or-regeneration-required.html

 

"automatic transaction mode is unofficially deprecated, and manual mode is recommended for all cases nowadays. Automatic transaction mode is considered obsolete."

 

http://thebuildingcoder.typepad.com/blog/2012/05/read-only-and-automatic-transaction-modes.html

 

Your add-in is probably not properly set up.

 

The getting started material will show you how to do so.

 

So will the Revit SDK samples.

 

There is absolutely nothing special you need to do to run display a Windows form.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
sylvain14d
in reply to: jeremytammik

Thank you Jeremy,





In fact it was not a Revit API programation problem but a classic vb.net problem.


I just use this and it works great.


Dim wf As New Form1
wf.ShowDialog()
Thanks a lot !
Message 6 of 6
patrick.emin
in reply to: sylvain14d

Bonjour, pour votre information, nous avons un forum en français: https://forums.autodesk.com/t5/revit-et-bim-francais/bd-p/198


Patrick Emin animateur de la communauté francophone


Vous avez trouvé un message utile? Alors donnez un "J'aime" à ce message!
Votre question a eu une réponse satisfaisante? Voulez vous avoir l'amabilité de cliquer sur le bouton
 APPROUVER LA SOLUTION  en bas de la réponse qui apporte une solution?
Signez notre Livre d'Or

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community