Cancel
Showing results for 
Search instead for 
Did you mean: 

Creating MUs from table using metho

Creator
Creator

Hi,

I'm working with plant simulation 13 and I would like to create MUs (by duplicating), change their names and change the attribute values. I created a method with the following:

 

var part: object;


-- creating parts
for local i := 1 to 10

 part:= .Models.MUs.Entity1.duplicate;
 part.CBG:=ProductData[2,i];
 part.PaintLineNr:=ProductData[3,i];
 part.load_part_descr:=ProductData[10,i];
 part.demand_date:=ProductData[11,i]; 

 part.name:=(to_str(ProductData[8,i]));
next;

 

The MU is created and also the attributes are changed (based on my table) . Only the name of the MU cannot be changed.

The following error pops up:
Invalid identifier or identifier already exists in the name scope of the object or one of its instances.


Thanks

5 REPLIES

Re: Creating MUs from table using metho

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
what is the result of
to_str(ProductData[8,i]) ?
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Creating MUs from table using metho

Creator
Creator

ProductData[8,i] consist of the product id's (a number e.g. 12345678)

Re: Creating MUs from table using metho

Creator
Creator

But I think there is a problem with the naming. It seems like it is not allowed ''change the name"

Re: Creating MUs from table using metho

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

this may be the problem, the name of a MU cannot start with a number

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Creating MUs from table using metho

Creator
Creator

Great! That was the problem. I put a P for it and it worked!

 

Thanks a lot