Import .ds library - classes

Hello everyone,
I want to “extend” Dynamo with a few simple classes so, I thinked to declare them in a designscript file and import it into dynamo. I searched on web but I found no real help.

  • First question: am I thinking right? Is the best approach? This because I can create classes inside python or c# nodes but in Dynamo enviroment they are not usable, simple “extraneous data” to pass (as far as I know).

So I’m trying to import this .ds file to start testing:

class Test
    test_prop = "prop";

that’s it, just like in Designscript reference guide, but File\Import Library\ simple says error and not import it.
Any help?

Make the class and any of its members you want to access in Dynamo public. When you import your dll ZT will represent them as nodes and you can still access your library in DS too.

I’m not trying to import a c# zero touch, but a designscript (*.ds) file.
Classes and members are public by default.
I’ve tried to mark explicity public, but with no success.
Thank you

@FabioDeAgostini Haven’t explored much, but see if this helps

class Test
	constructor cons(_x)
		x = _x;		


I’ve tried with your code, copy paste, saved. File\import library and it does’nt works…
( failed to load the library …)

What can it be?

No idea. Try importing this file (change extenstion to .ds as the forum doesn’t allow me to attach)
test.txt (66 Bytes)

@Vikram_Subbaiah Update: if I try to import from the home page it does’nt work, but if I try inside a new dynamo document it run.
But I don’t get your result: If I put a codeblock, it can be called, but I don’t find in the library as a node, like your result. Any idea?

This is what I did…


FYI @Aparajit_Pratap

1 Like

Yes, it is expected to work as @Vikram_Subbaiah describes importing the DS file. Individual nodes for each method in the class should show up in the library and they should be callable from code block nodes as well. I don’t think there is any documentation around this as it is an obscure workflow but if there are some users like @FabioDeAgostini who might find this useful, we should definitely have some documentation and examples on it. @Michael_Kirschner2?


There seems to be some, but it’s either outdated or inaccurate.
Would be good if it can be updated (or the language rectified to be consistent with the available documentation)

This bit of code from the Design Script Guide throws an error

class Point2D
	x = 0; // initialize property “x”
	y = 0;
	constructor ByCoordinates(x, y)
		this.x = x;
		this.y = y;


Also would be good if this forum allows Design Script (.ds) files to be uploded

Thanks @Vikram_Subbaiah for pointing this out. We’ll work on updating the documentation.


Hello all, thanks for help :slight_smile:
I found that the same ds file, fails to load on the home page of dynamo while, inside a dyn document works “well” like Vikram show.
It works like an .dll import, it also add the path to the list of packages folders.
Now the very simple test is working, it seems it was an error with Newtonsoft.JSON (why?? is it used to this kind of things??)

I will continue with some tests and I will get you updated with news, if any.

But the first question still: do you think this is a good (and fast, at least faster than compile a dll) way for having some custom object, custom classes?

@FabioDeAgostini yes, importing a DS file is very similar to importing a DLL. Note that importing a DS class limits you in the kinds of things you can do with those nodes as the language (DesignScript) is limited and not as rich as C#. Writing a C# class and importing a DLL in contrast is a much more powerful way of adding custom functionality. For simple workflows, however, using DS is not a bad idea.

Thank you Aparajit,
yes this was my intent, just to test some simple classes quickly, without external IDE, compiling and so on.