Cancel
Showing results for 
Search instead for 
Did you mean: 

Assignment to Object flow operation

Pioneer
Pioneer

Hello,

 

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.?

 

Thanx ..!!!

19 REPLIES

Re: Assignment to Object flow operation

Siemens Legend Siemens Legend
Siemens Legend

You can do that using

TxObjectFlowOperation.SetSimulatedObject method.

Example:

TxGripFrameCreationData gripData = new TxGripFrameCreationData(refTransform);
flowOp.SetSimulatedObject(currObject as ITxLocatableObject, gripData);

Re: Assignment to Object flow operation

Pioneer
Pioneer

Hello @Zachi_Mann,

 

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.

Thanx 

 

 

Re: Assignment to Object flow operation

Pioneer
Pioneer

Hello @Zachi_Mann,

 

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. 

 

Thanx

Re: Assignment to Object flow operation

Siemens Legend Siemens Legend
Siemens Legend

I didn't test this, bust something like this:

 

TxPlanningPart partToAssign = (TxPlanningPart)partITxObj.PlanningRepresentation as TxPlanningPart;
TxPlanningOperation planningOp = nonSimOpItxObj.PlanningRepresentation as TxPlanningOperation;
planningOp.AssignPart(partToAssign);

 

Re: Assignment to Object flow operation

Siemens Legend Siemens Legend
Siemens Legend

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?

Re: Assignment to Object flow operation

Pioneer
Pioneer

Ya, it works. Thanx a lot., But again i have a problem in solving nonsim assignment.

Itxobject first=TxApplication.ActiveSelection.GetItems()[0];
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?

 

Re: Assignment to Object flow operation

Siemens Legend Siemens Legend
Siemens Legend

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()[0] as ITxProcessModelObject;

 Extra question answer:

Just add this line in the beginning of the file:

using Tecnomatix.Planning;

No need for additional assembly reference.

Re: Assignment to Object flow operation

Pioneer
Pioneer
TxCompoundOperation compoundoperation = TxApplication.ActiveDocument.OperationRoot.CreateCompoundOperation(new TxCompoundOperationCreationData("Material Flow"));
            TxNonSimOperation nonsimoperation = compoundoperation.CreateNonSimOperation(new TxNonSimOperationCreationData("Generate_Appearance"));
            ITxProcessModelObject first = TxApplication.ActiveSelection.GetItems()[0] 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?

Thanx 

Re: Assignment to Object flow operation

Siemens Legend Siemens Legend
Siemens Legend

Are you in Line Simulation mode?

If so, does the same code work in Standard Mode?