Logic Machine Forum
Create virtual objects en masse - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Create virtual objects en masse (/showthread.php?tid=3441)



Create virtual objects en masse - JRP - 24.06.2021

Hi, how can I create a large number of virtual objects with the same specific properties, using a script, specifying a smaller address and a larger address or the desired number of addresses?

Greetings


RE: Create virtual objects en masse - Daniel - 25.06.2021

You received the answer already, use grp.create and some loop.
https://openrb.com/docs/lua.htm#grp.create


RE: Create virtual objects en masse - JRP - 25.06.2021

Hello

Yes, but I'm trying to use it and I can't make a loop that does what I want.

Greetings


RE: Create virtual objects en masse - admin - 25.06.2021

This will create 10 objects starting from 32/2/12:
Code:
address = buslib.encodega('32/2/12')

for i = 1, 10 do
  grp.create({
    address = address,
    datatype = dt.bool,
    name = 'object #' .. i,
  })

  address = address + 1
end



RE: Create virtual objects en masse - JRP - 25.06.2021

Hello Thanks is just what I needed.
The point is that I want to understand the buslib.encodega function.
What it does is get the id of the group address? What is a direct call to the object database?
I can't find it in the documentation.
Greetings


RE: Create virtual objects en masse - Daniel - 25.06.2021

It just converts group addresse in to numeric format.


RE: Create virtual objects en masse - JRP - 27.06.2021

ok.thanks


RE: Create virtual objects en masse - Dré - 27.06.2021

I did made a export in ETS, with a esf file.
I opened it in a notepad en edit the names, groupadresses en type.
and i imported in to the LM.
So i can edit all at the same time in a single view.
It also support to import a virtual object.
For me it was easier to do, and i could use different names types for all of these object.


RE: Create virtual objects en masse - admin - 28.06.2021

ESF works but you cannot specify the datatype there directly, only the data length in bits/bytes. This means that all 1 byte objects will have 05.001 scale datatype, 2 bytes will have 09 floating point datatype and so on.


RE: Create virtual objects en masse - JRP - 28.06.2021

(27.06.2021, 12:48)Dré Wrote: I did made a export in ETS, with a esf file.
I opened it in a notepad en edit the names, groupadresses en type.
and i imported in to the LM.
So i can edit all at the same time in a single view.
It also support to import a virtual object.
For me it was easier to do, and i could use different names types for all of these object.

Thanks for your contribution and admin for the clarifying note.

Greetings


RE: Create virtual objects en masse - Dré - 22.08.2021

(27.06.2021, 12:48)Dré Wrote: I did made a export in ETS, with a esf file.
I opened it in a notepad en edit the names, groupadresses en type.
and i imported in to the LM.
So i can edit all at the same time in a single view.
It also support to import a virtual object.
For me it was easier to do, and i could use different names types for all of these object.

Is it possible, this corrupt my Wiser?

It looks like it worked for a month, but after a restart of the Wiser, the Wiser didnt had a 'Object' and i didnt had a script anymore.
after i realise it was corrupt after the restart i would use a backup , but the first few backups had the same problem.

tha backups where not empty, all the pictures where in the backups.

But i also used the esf import (edited) file before.


RE: Create virtual objects en masse - admin - 23.08.2021

This can be caused by the the internal microSD card being in read-only state. The only solution is to replace it.


RE: Create virtual objects en masse - Dré - 23.08.2021

(23.08.2021, 06:38)admin Wrote: This can be caused by the the internal microSD card being in read-only state. The only solution is to replace it.

I also tried to import the backup to another LM and also there all object and scripts are gone, any idea why it didn't make a backup of all objects and scripts?