bvn-architecture / RevitBatchProcessor

Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
GNU General Public License v3.0
288 stars 76 forks source link

run vb.net dll instead of c# dll #47

Closed rayray4105 closed 4 years ago

rayray4105 commented 5 years ago

Hi,

Is there a way to run vb.net dll instead of c# dll? I have some routines in different coding and I would like to run them both.

regards, Raymond

RyanSchw commented 5 years ago

I found a quick tutorial on how to call a vb.net function from IronPython. This tutorial is for IronPython 1.1.1 (RBP runs 2.7.x?), but the idea should be the same.

As far as I can see, you should be able to use the same method to execute as C# using the .dll import.

rayray4105 commented 5 years ago

You are absolutely right. Running VB code works in the same manner. AddReferenceToFile can be replace with AddRefence I believe.

clr.AddReferenceToFile("AutorunTestDLL.dll")
from AutorunTestDLL import Autorun

Autorun.AutorunTestShared(doc,uiapp)

Passing arguments also possible when using a 'public shared sub' or 'public shared function

Public Class Autorun

    Public Shared Sub AutorunTestShared(ByVal doc As Document, ByVal uiapp As UIApplication)

    End Sub

End Class
RyanSchw commented 5 years ago

Thanks for the info and I'm glad you got it working!

I'll go ahead and add your comments to the documentation.

btw, you can do block code comments by doing ``` at the top and bottom (single ` is just for single line)

rayray4105 commented 5 years ago

Thanks for the tip ;)