ignatandrei / NETCoreBlockly

.NET Core API to Blockly - generate from WebAPI, Swagger, OData, GraphQL => https://visualapi.azurewebsites.net/
https://ignatandrei.github.io/BlocklyAutomation/
MIT License
169 stars 34 forks source link

Library of Blockly functions #163

Closed djaus2 closed 2 weeks ago

djaus2 commented 2 weeks ago

Can we have a mechanism of saving a set of Blockly functions separate from the app so that they can reloaded into another app as a single entity.? eg

ignatandrei commented 2 weeks ago

I will make an example with custom categories ASAP

ignatandrei commented 2 weeks ago

Update latest nuget.org/packages/NetCore2Blockly version 8.2024.503.745

Put a file named customCategories.txt

<category name='CategoriesLoaded'>
</category>

and inside put your blocks

image

djaus2 commented 2 weeks ago

Using version 8.2024.503.745

OK so have created app with simple function: image

Downloaded that and extracted the function part of it:

  <block type="procedures_defnoreturn" x="107" y="488">
  ...
  ...
  </block>

I created a file in Downloads directory where DownloadBlocks saves to, called customCategories.txt. With the block code in it:

<category name='CategoriesLoaded'>
  <block type="procedures_defnoreturn" x="107" y="488">
    <field name="NAME">GetData</field>
    <comment pinned="false" h="80" w="160">Print current Date-Time</comment>
    <statement name="STACK">
      <block type="text_print">
        <value name="TEXT">
          <block type="displayCurrentDate">
            <field name="dateFormat">human</field>
          </block>
        </value>
      </block>
    </statement>
  </block>
</category>

The "Category" isn't being loaded. ???

Also added <xml ..> and tags before and after the category tags with same result. Guessing issue might be where to place the file??

ignatandrei commented 2 weeks ago

Sorry for not being clear The folder for the file is assets\loadAtStartup

For your case , make a folder named loadAtStartup in SoftataWebAPI\wwwroot\BlocklyAutomation\assets and put there the file

djaus2 commented 2 weeks ago

Thanks that all worked. :)

SoftataWebAPI\wwwroot\BlocklyAutomation\assets\loadAtStartup
customCategories.txt
djaus2 commented 2 weeks ago

All good now, thanks again. :)