How do I get my dynamo code into visual studio? - c#

I currently have a dynamo project with a useful macro that I use in Revit, however, I can only run this if I have dynamo and Revit open at the same time.
I would like to add this macro onto my ribbon tab within Revit but cannot do this while the macro is built in dynamo.
Is there a way I can either:
Export the macro I have made inside dynamo into a .dll?
Open it up in visual studio and build the code in there?
View the code in dynamo?
Many thanks,
Dan

There are a number of ways to achieve this.
Most of them involve several different translation steps.
All of them would require you to access, extract and save the Python source code in an external text file to begin with.
Not being very familiar with the Dynamo and Python side of things, coming from the C# .NET add-in side, I would suggest trying to integrate your code into the pyRevit IronPython script library once you have it in hand:
http://thebuildingcoder.typepad.com/blog/2016/04/the-pyrevit-ironpython-script-library.html
Afaik, that is easy and provides exactly what you are asking for.

Related

How to execute open office cal (macro) in asp.net core application

I am developing asp.net core application that downloads some excel files and executing macro on it.
Macro is performing some data validation and data formatting and generating new excel file. I need to save this file in a specific folder on the server.
I have hosted this application on centos 7 so obviously Microsoft interop service will not work. So, I have to execute macro using open office.
If anyone can help then it will be very much appreciated.
As you said, COM interop will not work on CentOS, so you probably want to use Java or Python instead.
However, it may work to do a C# system call and execute a Basic macro. An example from https://ask.libreoffice.org/en/question/150565/execute-macro-in-calc-from-terminal/:
soffice "macro:///Standard.Module1.Ora(2,3)" "/home/lim/Scrivania/Test.ods"
With this setup, much of the code will be in Basic. If you are not familiar with the language, a good place to start is http://www.pitonyak.org/oo.php.

Run ICE Validation against windows installer database using c#

I'm wondering if anyone can help.
I have an c# application to make modifications to multiple in house msi files.
We want to run ICE validation and get the results back in my application. I know i can run MsiVal2.exe as a process and output the results back to the app but i would ideally like to run it all via code.
There is an evalcom2.dll which appears to be written in c++ but there seems to be very little information around using this.
Im surprised that nobody seems to have done this or is there an easier way like using one of the wix libraries or some thing?
Any Help would be much appreciated.
WiX Toolkit: I don't really use it manually that much (I validate using Orca), but the WiX toolset itself contains the binary smoke.exe. I believe it is run for every build in Visual Studio? Not sure. The full source available on github.com.
Looks possible to adapt to your own project. You could also just pass it to the compiled smoke.exe I guess. In the code, you can see:
Line 180: validator.Validate(Path.GetFullPath(inputFile));
Validator.cs is in the WiX project (https://github.com/wixtoolset/wix3/tree/develop/src/tools/wix)

Share code between office applications

I have written two addins , 1 for excel and 1 for word. However these addins have a lot of duplicates: Database handling, file handling,array handling which I would like to update 1 place instead of two.
We do have access to sharepoint, and could get access to visual studio. The thing is that people like to use file explorer and find the correct word or excel file, then open it then press a button inside the application which then should do things with the active document.
This is why we haven't written it as a .Net application yet, because that requires that people browse for the file inside the .NET application uless I am mistaken.
Is it possible to make an Addin which works both excel and word, or a dll? AnAnother important thing is that it should be easy to roll out a new version to the user, like stored on a network drive or similar.
Yes it is possible
The Hard Way
You can create a .Net DLL and call it from VBA. In visual studio a lot of people use Unmannaged Exports by Robert Giesecke to create DLLs that don't need to be registered (that way the DLL can be shipped with your document, and as long as it can be found you can use it).
Alternatively you might be able to do it manually as shown here by Hans Passant.
The Easy Way
Once the DLL is created you can declare it in a VBA module the same way you declare any other DLL for Late Binding and then call it from your code.
OR if you're happy to create the DLL and add it as a reference (possibly less portable) you can make it COM visible and register it for COM Interop in Visual Studio; this is probably the easiest way to go because you can then use Early Binding.
This is a walk through that might help: http://www.geeksengine.com/article/create-dll.html
But if you want to store the DLL on a network drive, well it might be that you really want to look at doing it the 'hard way', in which case look here: https://stackoverflow.com/a/5934745/3451115 and here: https://msdn.microsoft.com/en-us/library/bb687915.aspx

How to make an update function to your SAP AddOn?

Hi all I have already created some addons to SAP Business one in c#. Now what i want to do is that everytime I create a new function my addon should be able to automatically download it from a database server. What I plan is to include all these functions in a database table with columns such as (FuncName, EventType, EventForm, EventField, EventColumn, FuncCode). And there will be a globle function in my addon code which has several switch cases and so on... But how can I automatically create new function inside the source code by just reading these data from the table. Any proper guidance will be appreciated.
I'm an Intern in a software company. So I'm not that great with programming. Therefore please don't give the answers in a very complicated way :-D
********I understood that the above method is extremely difficult!!!
UPDATE: If this is a bad idea please suggest me a better way to do this. But consider that there are a lot of customers who gonna use this addon and they want to eassily download newly created functions to this addon
*** If someone alreday creadted AddOns to SAP B1 could advise me how they managed to provide updates to their Add-Ons while been registered under SAP B1 would help me a lot. Because I still couldn't solve this problem!!!
UPDATE: I already created my own updater function to a SAP Addon. In this updater function I replace the current exe file with new version's exe. And it works completely fine. But the problem occurs after registering this addOn in SAP. Because there are lot of check sums in SAP which makes the addon not working after I replace the old exe file. And I have no idea how to update my addOn without replacing the exe file. Any valuable suggestion would be highly appreciated.
This would be very hard to do, because the code has to be compiled. I would suggest you create an updater inside your application and use something like Jenkins.
Jenkins can build your application after every commit on a repository like github and then you can add logic to your software to pull the new binary (.exe) and install it as an update. Even better would be a library (.dll), then there would be no need for an installer. I hope I sent you in the right direction.
You'd do something like this:
Add your code to a repository system with a build server.
For example Github and Jenkins
Add an autoupdater function in your code
For example with the .NET Compact Framework
The way I solved this problem was by putting the new functions inside a dll file. And add it as a reference in the application. Finally I wrote an update function which replaces the current dll file if there's a new version available in the provided FTP server path. This way I didn't have to override the exe file and therefore it was not needed to worry about the checksum anymore.

Call VB method in C# using Interop

Okey here's the situation: I've got a microsoft excel macro in vb that I want to call using C#. I've already tried creating a workbook using Microsoft.Office.Interop.Excel, however I don't want to have to run an excel process to run the macro.
So then I thought why not make a vb class library with my code in it so i can still run it and have a clean dll file. It's not needed to keep any sheet related functions since the macro reads a .lua(UTF-8)text file with some advanced regex functions that I just can't get recreated in C#.
Is it possible for me to make the library use interop as well so i can just call the function in my C#? Any examples would be greatly appreciated.
First I assume you are working with VB6 and not VB Script?
I have never worked with VB 6 or earlier, but I think your best be will be to create a COM object and then you can call the COM object from .NET using C#. Here is a quick link I found through BING that I believe will help you get started if this in an option for you.
Walkthrough: Implementing Inheritance with COM Objects (Visual Basic)
I noticed these two statements:
I don't want to have to run an excel process to run the macro
and
the macro reads a .lua(UTF-8)text file with some advanced regex functions that I just can't get recreated in C#
Those two goals are incompatible. The macro relies on excel functions to run. The only way provided by Microsoft to accomplish this is to completely load the Excel app. There is no way to only run the macro.

Categories

Resources