This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Create virtual objects en masse
#1
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
Reply
#2
You received the answer already, use grp.create and some loop.
https://openrb.com/docs/lua.htm#grp.create
------------------------------
Ctrl+F5
Reply
#3
Hello

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

Greetings
Reply
#4
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
Reply
#5
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
Reply
#6
It just converts group addresse in to numeric format.
------------------------------
Ctrl+F5
Reply
#7
ok.thanks
Reply
#8
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.
Reply
#9
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.
Reply
#10
(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
Reply
#11
(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.
Reply
#12
This can be caused by the the internal microSD card being in read-only state. The only solution is to replace it.
Reply
#13
(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?
Reply


Forum Jump: