I have created MyBlocks but want to change the input parameter to negative. Is this possible or must all the MyBlocks be re-written?
5 Answers
It is possible now (since version 1.3.0) by pressing the button at the upper left corner of the block:
It is not possible to modify the properties of myBlock in the current version of EV3 SW.
It is possible by tampering the block source files:
- create a copy of your
*.ev3
. Just in case - rename
*.ev3
to*.zip
- extract all files from the
zip
- edit files as needed
- move changed files back into
zip
(Under Windows drag and drop to zip) - rename
*.zip
to*.ev3
I successfully used this to change the icons for MyBlocks. Icons file should be here: C:\Program Files (x86)\LEGO Software\LEGO MINDSTORMS EV3 Home Edition\Resources\MyBlocks\images
If you change the parameters, you will have to change all programs that use the MyBlock because the definition has changed.
I have tried it with success, having a backup is a must, you can easily corrupt your project files. I was able to modify the icon of parameter or myblock, rename the parameter, change the order of parameters, change the default values, add a new parameter. It is also possible to change the parameter type or delete the parameter, the lab sw removes existing wires correctly.
I would not tamper the files for some simple block, but for more complex block it could be worth. Let's hope some sw update will provide this function later, if it could be done manually, i see no reason why it is not implemented.
If you need to change something that is setup in the "My Block Builder" dialog box like the default value or min and max values for a slider, then yes, you need to create a new My Block. This is easy though. Just select everything in the existing My Block except for the Input Parameter block, the Output Parameter block and the Start block and then select Tools > My Block Builder to create a new (identical) block.
Another option would be to add a Math block inside of your My Block that multiplies the input parameter by -1 to make it negative.
If only we knew the developers' thoughts perhaps they intentionally made it hard to change MyBlocks in order to support some programming paradigm for kids (according to their opinion).
What I do is:
- Always put the variables into the block while their values come from outside constants. Never cross commands boundaries with wires. Put all the variables inside the block, next to their use, no matter how many times you use them. The order of the block's wires is usually the order of their first use inside the block.
- Make a copy of the program you want to routine
- Make a block of the copy:
- Give the block a very clear name
- Put no effort in any other features until you test the block to work 100%.
- For the final block version: just create it anew while still retaining the original commands, in a different file.
I know it is few years late but I just looked for this and then found an alternative/workaround. There is no way to edit a custom block, but one can select all of it (except inputs and outputs) and create a brand new block from it, then delete the original.
Too bad there is no direct way for this.