Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library of Blockly functions #163

Closed
djaus2 opened this issue May 2, 2024 · 6 comments
Closed

Library of Blockly functions #163

djaus2 opened this issue May 2, 2024 · 6 comments

Comments

@djaus2
Copy link

djaus2 commented May 2, 2024

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

  • As a separate page
  • As a single block( or one for reach function) on the app page .
@ignatandrei
Copy link
Owner

I will make an example with custom categories ASAP

@ignatandrei
Copy link
Owner

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
Copy link
Author

djaus2 commented May 4, 2024

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
Copy link
Owner

ignatandrei commented May 4, 2024

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
Copy link
Author

djaus2 commented May 4, 2024

Thanks that all worked. :)

  • Using version 8.2024.503.745
  • Created folder
SoftataWebAPI\wwwroot\BlocklyAutomation\assets\loadAtStartup
  • Created text file in that folder called:
customCategories.txt
  • Made sure it was being copied to the built output
  • Inserted code as previous (WITHOUT the XML monikers)!
  • Ran Blockly and could access any functions in that file via CategoriesLoaded.
  • Functions then available under Basic-->Functions
  • Functions renamed if already existing
  • Can then reuse functions.

@djaus2
Copy link
Author

djaus2 commented May 4, 2024

All good now, thanks again. :)

@djaus2 djaus2 closed this as completed May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants