Compile .exe file from Dynamo script?

Hello there!
I’m wondering if there is a way to make an executable file from a Dynamo Sandbox script?

Suppose I have a graph that opens a navis file, run clash tests,and export some data to Excel. I could add some Data-Shapes nodes to make the UI, but still the person needs to open Dynamo Sandbox to run it. Is it possible to “compile” the script into an .exe? Or do I need to do it in C#? Or is there another workaround I don’t know about?

*This is not to hide the “know how”, it’s just to make it simpler for users who don’t use Revit, so Dynamo Player is not an option.

Thanks very much in advanced,
Matias

Not without recoding to basically build your own program from scratch.

Likely easier to build a simple custom node incorporating all the things you need except the variable inputs.

You could also look at setting up a web server, functioning like the prior Dynamo web UI which was accessible from the Dynamo Studio’s send to web, but where you control the content (nodes, packages, etc) which it can access.

Hi Jacob!
Yes, i thought it would take to much code.
So i started digging, and i found out I can use the Dynamo Command Line Interface to run it from the command prompt, and I can build a small python code to get the line …\Dynamo\Dynamo Core\2.0\DynamoCLI.exe -o “filepath”. And then, make that Python executable, wich would open the windows explorer and get the selected filepath. Kinda complicated, but i have hope.

I guess it can work as a Dynamo Player for Sandbox, if u give GUIs to the graphs

2 Likes

Just made this. It kinda works.
I reduced the graph so it only open Navis, and so far so good. Navis opens, and i get some errors

Code:

from tkinter import *
from tkinter import filedialog
import subprocess

root = Tk()
root.withdraw()

file_path = root.filename = filedialog.askopenfilename(initialdir="/", title="Selecciona archivo .dyn", filetypes=[("Dyn Files", "*.dyn")])

command_line= r'C:\PROGRA~1\Dynamo\DYNAMO~1\2\DynamoCLI.exe -o ' + '"' + file_path + '"'

subprocess.run(command_line, shell=True)

Errors:

Excepci�n no controlada: System.AccessViolationException: Intento de leer o escribir en la memoria protegida. A menudo, esto indica que hay otra memoria da�ada.
   en Autodesk.LibG.LibGPINVOKE.end_asm_library()
   en Autodesk.LibG.LibG.end_asm_library()
   en Autodesk.LibG.ExtensionApplication.ShutDown()
   en ProtoFFI.ExtensionAppLoader.Terminate()

If anyone has some idea on how to improve it, let me know

Update: I add an export to excell section to the graph, but because of the System.AccessViolationException: Intento de leer o escribir en la memoria protegida it doest write anything to the excell file, although it opens. Has anyone an idea on how to solve this? I tried to excecute the commando line as an administrator, but its not the case
thanks in advance

My guess is that the OS isn’t allowing you to use external command to call an external command that calls an external command. If it walks like a duck and talks like a duck, should we be surprised if the duck hunter takes aim?

don’t worry about that error -
The issue here is that your dynamo script is running in the CLI - so it doesn’t have access to Revit or any other host APIs. (maybe it has access to Navis if that’s a COM api)

add some debug logic to your graph and use the -verbose flag to see what values some of the nodes have.

2 Likes

hahahaha! makes sense

I dont thinks its because of that, at least for this script: both programs, Naviswork and Excell, open. The script fails to “write” the Excell, or saving the Navis file. I will try what u suggest anyway, just in case. Will keep u posted!
Thanks!

1 Like

FYI: Datashapes UI++ currently requires access to the Revit API to run, even if you aren’t using a Revit interaction.