I want to assign a part of loaded study to an operation. I found there are TxPlanningPart and TxPlanningOperation, both have property and method for assigning part to operation. Bcz of delegates and events for assigning part to operation, i want to know, what should be right step towards completion of my task. Plz help me and advise some steps
Solved! Go to Solution.
What kind of part and operations are we talking about? Because depending on the scenario, the assignment is "automatically" done as the result of creating an operation.
Example: If you create a weld operation with some weld points, the weld points are automatically assigned to the operation. So the assign between a mfg and an operation is like the result of creating an operation with mfgs.
Can you explain to me how you assign a nonsim operation manually? Because I was taking a look in the creation of a nonsim operation and there's no field to assign it to a part.
The field you're setting is an eMServer field, so you can assign using planning representation of the object. An example of assigning a part to a selected non-sim operation:
TxObjectList partList = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxComponent))); TxObjectList list = TxApplication.ActiveSelection.GetAllItems(); TxNonSimOperation nsop = list as TxNonSimOperation; TxPlanningOperation op = nsop.PlanningRepresentation as TxPlanningOperation; op.AssignPart(partList);
Check if it works for you
Super your given code works. .I have a smal query now, may be u can help me in that. I want to create start signal of nonsimoperation. So , i have applied this method,
First this code create output signal and then it is set as StartinSignal of nonsimoperation.
But problem is when i click on "Create Non-Sim Start Signal" button in control menu.. It again craetes Start opearaton. That means signal created by this code is not start signal of operation. So how can i solve this problem and create start signal of nonsim operation. Can u suggest me correct way to do it?
TxPlcOutputSignal startsig = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram.CreatePlcOutputSignal(new TxPlcOutputSignalCreationData("NonSim_Start")); startsig = nonsimoperation.StartingSignal as TxPlcOutputSignal;
Last line from your code looks inverted to me. Maybe:
TxPlcOutputSignal startsig = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram.CreatePlcOutputSignal(new TxPlcOutputSignalCreationData("NonSim_Start")); nonsimoperation.StartingSignal = startsig;