Cancel
Showing results for 
Search instead for 
Did you mean: 

Logic Blocks

Legend
Legend

Hello,

I am looking in the .Net API help for classes or methods to create a logic block but I cannot find anything.

So my question is if it is possible to create a logic block by using the API?

2 REPLIES

Re: Logic Blocks

Creator
Creator

Hi

 

Yes it is possible please see ITxPlcLogicBehaviorCreation the fuction CreateLogicBehavior

 

Dim PLClogicBehavior As TxPlcLogicBehavior

PLClogicBehavior = device.CreateLogicBehavior(New TxPlcLogicBehaviorCreationData)

 

Dim TxPlcLogicBehaviorEntryCreationData1 As New TxPlcLogicBehaviorEntryCreationData

 

TxPlcLogicBehaviorEntryCreationData1 = New TxPlcLogicBehaviorEntryCreationData("Name")

Dim PlcLogicBehaviorEntry1 As TxPlcLogicBehaviorEntry =

PLClogicBehavior.CreateEntry(TxPlcLogicBehaviorEntryCreationData1)

 

Regards

 

Re: Logic Blocks

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi,

 

Another example in C#

        private void CreateLB()
        {
            ITxPlcLogicBehaviorCreation device = TxApplication.ActiveSelection.GetItems()[0] as ITxPlcLogicBehaviorCreation;

            TxPlcLogicBehaviorCreationData lbCrData = new TxPlcLogicBehaviorCreationData("myLB");
            TxPlcLogicBehavior myLB = device.CreateLogicBehavior(lbCrData);

            TxPlcLogicBehaviorEntryCreationData entryCreationData = new TxPlcLogicBehaviorEntryCreationData("entry1");
            entryCreationData.HardwareType = TxPlcHardwareType.Int;
            ITxPlcLogicBehaviorEntry entry = myLB.CreateEntry(entryCreationData);

            TxPlcLogicBehaviorExitCreationData exitCreationdata = new TxPlcLogicBehaviorExitCreationData();
            exitCreationdata.Name = "exit1";
            exitCreationdata.HardwareType = TxPlcHardwareType.Bool;
            //here you can define Expression, IfCondition, StopCondition, TimeDelay of the exit
            ITxPlcLogicBehaviorExit exit = myLB.CreateExit(exitCreationdata);

        }

 

Best Regards,

DianaG