CreateCommand creates a simple command using TxRoboticCommandCreationData - this creation data can only recieve some text as input.
CreateCompositeCommand creates a command with additional parameters given by an array of elemets of (abstract) type TxRoboticCompositeCommandElement.
For instance you could create composite command as follows:
ArrayList elements = new ArrayList(); var myCmd = new TxRoboticCompositeCommandStringElement("MyObjCommand"); var objElt = new TxRoboticCompositeCommandTxObjectElement(obj); //obj is some ITxObject TxRoboticCompositeCommandCreationData creationData = new TxRoboticCompositeCommandCreationData(elements);
operation.CreateCompositeCommand(creationData); //operation is some ITxRoboticOperation
Thank you for the explanation!
An example for create command would be:
# Blank <componentname>
What about the commands # Drive Device and # Wait Device?
Must these commands be created with compositeCommand?
It is better to create them as composite, so it supports renaming of object as well as several object with same names. However the simulation does support such commands (# Blank, # Attach, # DriveDevice, etc...) as pure string commands via a research of relevant object with the given string name.
To make it clear.
I can all spot attributes (# Blank, # Display, # Drive Device, # Wait Device, # WaitTime, ...) either create with CreateCommand or CreateCompositeCommand?
Yes, both will be simulated. The advantage of creating a composite command is explained in my previous answer.
unfortunately I am still having big problems to create a composite command.
Let's say we have the following command:
# Blank part_x
part_x is of type TxCompoundPart in the study.
How can I determine the right object in the study if the command is only a string because it comes from a file (e.g. no_robot from Robcad)?
In theory more than one object in the study could have the name part_x.
Now, I found the methods GetObjectsByName and GetObjectsByID. I think these methods will solve one part of my problem.
Useful post, but one small point - I think you omitted the step of adding myCmd and objElt to the elements arraylist: