Cancel
Showing results for 
Search instead for 
Did you mean: 

Moving an object to another frame via SimTalk

Gears Phenom Gears Phenom
Gears Phenom

Hello all.

 

I want to know if it is possible to move an object (to be more specific a frame) to another frame via a simtalk command?

 

So far I have got it working through using the 'CopyObject' command (with the target frame as the first parameter) and then using the 'DeleteObject' command on the old object but in doing so both the old and new objects exist at the same time. As they exist at the same time then the MU's stored within the frame have to be renumbered to stop conflicting MU numbers while instead I need it to move the frame and its contents to a different frame without changing it.

 

I have not managed to find any command myself which can do this so thought I would ask the wider community.

 

JamesM

 

Edit

Sorry, meant 'CreateObject' and not 'CopyObject', sorry for the confusion.

11 REPLIES

Re: Moving an object to another frame via SimTalk

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello JamesM,

the identifier CopyObject is unknown. You must use createObject and deleteObject.

I made the following test. It worked:

if existsObject(".Models.Frame1.SingleProc") then
obj := .Models.Frame1.SingleProc.createObject(.Models.Frame2, 200,100);
.Models.Frame1.SingleProc.deleteObject;
obj.name := "SingleProc";
else
obj := .Models.Frame2.SingleProc.createObject(.Models.Frame1, 200,100);
.Models.Frame2.SingleProc.deleteObject;
obj.name := "SingleProc";
end;

where obj is a local variable of type object.

 

In the Help there is an entry for "Copy Object". On this page a link to createObject and deleteObject would be helpful. Thanks for the hint.

 

Regards,

Peter

Re: Moving an object to another frame via SimTalk

Gears Phenom Gears Phenom
Gears Phenom

Hello.

 

Sorry, was a long day and was asking the question out of memory without checking Plant Sim.

 

That is roughly what I am already doing. If you create a sub frame and then place into it a object and on that object place a MU and then run your code on that sub frame, you will see that the MU changes. This is the issue I am having, I want the MU's to stay the exact same instead.

 

JamesM

Re: Moving an object to another frame via SimTalk

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello JamesM,

if you create an instance of a MU on the SingleProc and run the method RunMeSeveralTimes then you will create new instances of the MU. Since each instance is describe by its class and an individual number (ID) the IDs will grow. The IDs of deleted MUs are not used during a single simulation. After a reset of the Eventcontroller the IDs start again with 1.

 

The attached model is for Plant Simulation 12.0

Regards, Peter

Re: Moving an object to another frame via SimTalk

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

Yes I understand that, if you step through the code you will see that between the createObject and deleteObject lines of code the singleproc with the MU on it exists within both frames, so it is renumbered to stop conflicting numbers.

 

I want to find a way to move the object to another frame without having the MU number change.

 

JamesM

Re: Moving an object to another frame via SimTalk

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello JamesM,

 

what is your target? Please note that properties, like the attribute RandomSeed of the Singleproc will changed in our example, such that the behavior during a simulation will changed.

 

The following ideas to your question consists in moving the MU instance.

 

is
obj, MUobj:object;
do
if existsObject(".Models.Frame1.SingleProc") then
MUobj := .Models.Frame1.SingleProc.cont;
MUobj.move(.Models.Frame1.Store);
obj := .Models.Frame1.SingleProc.createObject(.Models.Frame2, 200,100);
.Models.Frame1.SingleProc.deleteObject;
obj.name := "SingleProc";
MUobj.move(obj);

else
MUobj := .Models.Frame2.SingleProc.cont;
MUobj.move(.Models.Frame2.Store);
obj := .Models.Frame2.SingleProc.createObject(.Models.Frame1, 200,100);
.Models.Frame2.SingleProc.deleteObject;
obj.name := "SingleProc";
MUobj.move(obj);
end;
end;

Re: Moving an object to another frame via SimTalk

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

Have tried a few things and can't seem to find anything that would be of use. To me this looks to be a missing function within Plant Sim more than anything else right now.

 

Your idea of moving the MU's to a temporary storage location is not ideal but works well, just relies on knowing the exact internals of the subframe to know where to look for the MU's and having anything length based in there makes it more complicated (but still possible to be the locations of them all from the ContentsList).

 

JamesM

Re: Moving an object to another frame via SimTalk

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi JamesM,

 

Could you perhaps give a bit more background information regarding your question? What is the issue behind it, what kind of situation are you trying to model?

 

The MaterialFlow objects are primarily meant as a static structure (which they do represent in most cases), so moving them around is not really envisioned. But we may have some creative ideas for you.


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: Moving an object to another frame via SimTalk

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

An example would probably best explain it.

 

Lets say have 2 systems, the 2 systems were built as 2 seperate models and each of which has a common interface of a storage unit. I can export them both as object files and bring them into the same plant sim model, but for many reasons i will not combine them into the same frame.

 

In 1 frame the MU's are edited, the 3D graphics are edited and then they are loaded into this storage area which I then want to move to the other frame and then get the MU's out of them. The storage area cant just be a store, it must contain various material flow objects.

 

Now, yes I could keep it in a area and then move the MU's there and then later move them to the other frame, but instead I want to move the storage area to the frame it is needed so it looks like it should look. 

 

As it is, the CreateObject and DeleteObject that Peter first recomended I am using, but the issue is despite all of the attributes being carried over the 3D graphics of the MU is not. If I could instead move the storage frame and not have to recreate it and destroy the old one then the MU's will move with it.

 

JamesM

Re: Moving an object to another frame via SimTalk

Siemens Genius Siemens Genius
Siemens Genius

Have you considered storing the MUs in a Vehicle with "store" as it's load bay?
This way, you could simply create the MUs you need, with all of their attributes, store them on the vehicle and then move the vehicle to a dummy/disassembly station, so that you have the original MUs in the new frame.
for your fixed material flow elemtens, you would still have to duplicate/ create them anew and delete the old instances though.