get all the blocks name in workspace

66 views
Skip to first unread message

jose_trindade1

unread,
Nov 2, 2021, 1:14:20 PM11/2/21
to Blockly
how can i get all the blocks name that is in the workspace?
and save it in a file

pigeonmaléfique

unread,
Nov 2, 2021, 1:31:08 PM11/2/21
to Blockly
If I understood your question correctly

var blocks_name = [];
//  Get all blocks loaded
for(var x in Blockly.Blocks){
  // X is the block's name
blocks_name.push(x);
// your code
}

And for save it : look at this

Beka Westberg

unread,
Nov 2, 2021, 1:32:57 PM11/2/21
to blo...@googlegroups.com
Hello! Depending on what you want to do, workspace.getBlocksByType() might also be helpful =)
--Beka

On Tue, Nov 2, 2021 at 1:14 PM jose_trindade1 <trinda...@gmail.com> wrote:
how can i get all the blocks name that is in the workspace?
and save it in a file

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/739c95bd-8bdf-4566-a08f-654e8280585cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages