What is the easiest way to generate 1000 Entity of MU (in this case p1 till p1000) without duplicating 1000 times?
(See on the left side of the picture below)
what about using the source functionality, see the picture below. In this setting the source object will create exactly 1000 MUs.
I think this is the easiest way...
Thank you for your quick reply.
But my question is that I would like to generate 1000 different types of part (I means1000 variants). Those 1000 variants are having differnt quanitity of parts to be produced with different processing time.
Is it possible?
In this case, the parts are independents, in other words, there's no inheritance hierarchy, so, you could set each one as necessary.
To create these parts you could use a table as sequence for a source.
For different attributes you could use the table as well.
Does it make sense? Maybe i didn't understand what you want to do.
just as I posted my comment I saw that I did not met the question exacly.
You can do your task easily through SimTalk. Use a method and type in the code as below:
local obj : object;
for local i := 1 to 1000 loop
obj := .MUs.entity.duplicate;
obj.name := "P" + to_str(i);
But you can also use the MU creation functionality of the source object. There you type in the class of an MU, the desired name (an MU ID will be added to the MU name automatically if you want to have more MUs created per line in the table)
And the you have the possibility to assign values to attributes of the created MU instance out of the sub-table in the cration list:
A little bit different piece of code below. A difference to given example that it creates 100 objects in a separate folder. This way it's easier to delete them Also it creates a custom attribute for objects.
Note that in this example Pxx objects are inherited from Entity (but it should be okay in most cases).
is obj : object; i : integer; do -- If folder already exists, delete it If existsObject(".User") then .User.deleteObject; end; -- Create folder for user objects obj := .createFolder; obj.Name := "User"; -- Create objects for i := 1 to 100 loop obj := .MUs.Entity.CreateObject(.User, 1, 1, "P"+to_str(i)); obj.createAttr ("Color", "string"); next; end;
However in my opinion it make sense to create so many different classes only in special conditions. Usually it's easier to create one type and work with custom attributes (i.e. create attribute "PartType"). You may need separate classes for example if you want to have different icons and in the same time use standard icon change behavior (Operational/Waiting). But making 1000x2 different icons is a big effort