I have created Object flow operation and now i want to attach or assign a part to be moved along with the operation execution. My query is how can i assign that part to this operation. Can someone help me to do this task.?
You can do that using
TxGripFrameCreationData gripData = new TxGripFrameCreationData(refTransform); flowOp.SetSimulatedObject(currObject as ITxLocatableObject, gripData);
Thanx for suggestion with coding. I have done it. But now another problem is , I have a Non-Sim operation and want to assign a Part to it, but i could not find method SetSimulatedObject method in it. so, by which way i can assign a part to it. Plz , suggest me a way.
That is not what i want. I am trying to assign a part to that operation as product instance. I have attached a photo here. Plz can you give solution for it? which method and property of objectflowoperation should i use.? Btw your given code will help me in future.
I didn't test this, bust something like this:
TxPlanningPart partToAssign = (TxPlanningPart)partITxObj.PlanningRepresentation as TxPlanningPart;
TxPlanningOperation planningOp = nonSimOpItxObj.PlanningRepresentation as TxPlanningOperation;
If you set the object as simulated object it should automatically be assigned to the product instances / resource instances according to the object type.
Is this not happening?
Ya, it works. Thanx a lot., But again i have a problem in solving nonsim assignment.
TxPlanningPart partToAssign = (TxPlanningPart)first.PlanningRepresentation as TxPlanningPart; TxPlanningOperation planningOp = nonsimoperation.PlanningRepresentation as TxPlanningOperation; planningOp.AssignPart(partToAssign);
I tried like , But it says, ITxObject does not contain defination for PlanningRepresentation(are u missing directive or referance),
Extra question: for Planning namespace do i need to add another referance?
I already add Engineering.dll as referance and also add both namespace engineering and planning. Do i need extra addition to that?
You need to cast ITxObject to the proper interface, e.g., using the 'as' operator.
In this case, the proper interface is ITxProcessModelObject.
When unsure which interface exposes which method, refer to the Tecnomatix.NET documentation.
ITxProcessModelObject first=TxApplication.ActiveSelection.GetItems() as ITxProcessModelObject;
Extra question answer:
Just add this line in the beginning of the file:
No need for additional assembly reference.
TxCompoundOperation compoundoperation = TxApplication.ActiveDocument.OperationRoot.CreateCompoundOperation(new TxCompoundOperationCreationData("Material Flow")); TxNonSimOperation nonsimoperation = compoundoperation.CreateNonSimOperation(new TxNonSimOperationCreationData("Generate_Appearance")); ITxProcessModelObject first = TxApplication.ActiveSelection.GetItems() as ITxProcessModelObject; TxPlanningPart partToAssign = (TxPlanningPart)first.PlanningRepresentation as TxPlanningPart; TxPlanningOperation planningOp = nonsimoperation.PlanningRepresentation as TxPlanningOperation; planningOp.AssignPart(partToAssign);
Hello , @Zachi_Mann
It creates both compound and nonsim operation but , but first selected part is not assigned to nonsimoperation. Can you check this code?