Skip to content

Commit 98bf5d4

Browse files
authored
Merge pull request #214 from TomMuehlegger/master
Fix S7 offline blocks with comments can't generate AWL Code
2 parents e5ce2d8 + 6f5ec50 commit 98bf5d4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

LibNoDaveConnectionLibrary/DataTypes/Projectfolders/Step7V5/BlocksOfflineFolder.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,24 @@ public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt)
668668

669669
FBStaticAccessConverter.ReplaceStaticAccess(retVal, prgFld, myConvOpt);
670670

671+
for (int i = 0; i < retVal.AWLCode.Count - 1; i++)
672+
{
673+
S7FunctionBlockRow akRw = (S7FunctionBlockRow)retVal.AWLCode[i];
674+
675+
if (akRw.CombineDBAccess)
676+
{
677+
S7FunctionBlockRow nRw = (S7FunctionBlockRow)retVal.AWLCode[i + 1];
678+
if (!nRw.Parameter.Contains("["))
679+
{
680+
nRw.Parameter = akRw.Parameter + "." + nRw.Parameter;
681+
nRw.MC7 = Helper.CombineByteArray(akRw.MC7, nRw.MC7);
682+
nRw.Label = akRw.Label ?? nRw.Label;
683+
retVal.AWLCode.RemoveAt(i + 1);
684+
retVal.AWLCode[i] = nRw;
685+
}
686+
}
687+
}
688+
671689
#region UseComments from Block
672690
if (myConvOpt.UseComments)
673691
{
@@ -800,24 +818,6 @@ public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt)
800818
retVal.AWLCode = newAwlCode;
801819
}
802820
#endregion
803-
804-
for (int i = 0; i < retVal.AWLCode.Count - 1; i++)
805-
{
806-
S7FunctionBlockRow akRw = (S7FunctionBlockRow)retVal.AWLCode[i];
807-
808-
if (akRw.CombineDBAccess)
809-
{
810-
S7FunctionBlockRow nRw = (S7FunctionBlockRow)retVal.AWLCode[i + 1];
811-
if (!nRw.Parameter.Contains("["))
812-
{
813-
nRw.Parameter = akRw.Parameter + "." + nRw.Parameter;
814-
nRw.MC7 = Helper.CombineByteArray(akRw.MC7, nRw.MC7);
815-
nRw.Label = akRw.Label ?? nRw.Label;
816-
retVal.AWLCode.RemoveAt(i + 1);
817-
retVal.AWLCode[i] = nRw;
818-
}
819-
}
820-
}
821821
}
822822

823823
retVal.Networks = NetWork.GetNetworksList(retVal);

0 commit comments

Comments
 (0)