Code Block Definition - Autocomplete and external availability

I created some definition in code blocks.I want to see these definitions like inbuilt definition in code block without pasting the definition code block in a new dynamo file.Is it possible?I created a definition maned mtb.I can’t find it in code block when I open a new dynamo session.

It is vissible when I open that file with the definition once.

Let me see if I understand right; you’d like to define a function once and then reference it across multiple Dynamo files?

I don’t think this is possible, I’m not sure you can “save off” discrete bits of code unless you start writing custom nodes / packages. Potentially build this function into a custom node and then you can reuse it across multiple graphs.

3 Likes

No I don’t want to make custom node or copy code block containing definition.Is it possible to add this definition inside dynamo sothat I can see them as normal definition like below.

Thanks

you are asking for autocomplete?

1 Like

@Konrad_K_Sobon>> Yes something like this. I want to make my definition like the above snap.I will write them once and want use them in code block.I don’t want to define them in every file if I need.

Well, so i will echo @erfajo saying that, no, you cannot write a definition in DS in one file and then get access to it in another.
Also, the autocomplete functionality is built into Dynamo and if I am not mistaken, it actually works only for compiled libraries that are currently loaded into Dynamo/Revit, or DS methods defined in current scope. That basically eliminates any DS code since it can’t be compiled at the moment.

@Michael_Kirschner2 or @Zach_Kron can correct me on any of the above statements.

1 Like

Autocomplete works but if I close the session it doesnt work.

OK, but that’s again because that method was defined in the current scope of the application. The next session of Dynamo has it’s own scope that doesn’t know about this, method and currently there is no way to make it aware.

Of course that would not be impossible, it just hasn’t been added to Dynamo as functionality just yet. If you wish, just go to github page and make a feature request: https://github.com/DynamoDS/Dynamo/issues

1 Like

@Konrad_K_Sobon actually I think you can write design script files and load them - for example, there are a few of nodes in dynamo which are implemented in designscript only and they get loaded when dynamo starts up. Like flatten.ds

6 Likes

Nice, never knew this existed. Can you demonstrate with a working sample?

1 Like

Hello All,
Can you show an example of design script writing and importing in dynamo as @Michael_Kirschner2 told.
Thanks