// Token: 0x06000225 RID: 549 RVA: 0x0000F1B0 File Offset: 0x0000D3B0
        protected double GetActualSpacingForUnitechnik(Transform t1, Transform t2, short angle)
        {
            ItGeVector3d distributionLengthVector  = this.GetDistributionLengthVector(t1, t2);
            double       distributionDirectionSign = SteelGroupElementRebarBase.GetDistributionDirectionSign(distributionLengthVector, angle);

            return(distributionLengthVector.length() * distributionDirectionSign);
        }
        // Token: 0x06000207 RID: 519 RVA: 0x0000E08C File Offset: 0x0000C28C
        private ItSegment CreateFirstSegment(List <ItGeCurve3d> rebarList, ItBar xmlBar, ItGeCurve3d firstCurve, ItGeCurve3d nextCurve, ref bool flipFutureYs, out ItSegment additionalSegment)
        {
            additionalSegment = null;
            ItGeVector3d  rebarElementNormal         = this.GetRebarElementNormal();
            ItGeVector3d  normalFromFirstTwoSegments = SteelGroupElementRebarBase.GetNormalFromFirstTwoSegments(rebarList, rebarElementNormal);
            ItGeLineSeg3d itGeLineSeg3d = firstCurve as ItGeLineSeg3d;
            ItGeCircArc3d itGeCircArc3d = firstCurve as ItGeCircArc3d;
            bool          flag          = itGeLineSeg3d != null;
            ItSegment     result;

            if (flag)
            {
                result = this.GetFirstSegFromLineSeg(xmlBar, itGeLineSeg3d, normalFromFirstTwoSegments, nextCurve, ref flipFutureYs);
            }
            else
            {
                bool flag2 = itGeCircArc3d != null;
                if (flag2)
                {
                    result = this.GetFirstSegFromCircArc(xmlBar, itGeCircArc3d, normalFromFirstTwoSegments, ref flipFutureYs, out additionalSegment);
                }
                else
                {
                    result = null;
                }
            }
            return(result);
        }
        // Token: 0x060001E4 RID: 484 RVA: 0x0000D60C File Offset: 0x0000B80C
        private static bool IsSingleIronInXYPlane(List <ItGeCurve3d> firstList)
        {
            ItGeVector3d directionFromCurve = SteelGroupElementRebarBase.GetDirectionFromCurve(firstList[0]);
            ItGeVector3d refVec             = directionFromCurve.crossProduct(ItGeVector3d.kZAxis);
            ItGeVector3d vec = directionFromCurve.orthoProject(ItGeVector3d.kZAxis);
            double       a   = directionFromCurve.angleTo(vec, refVec);

            return(a.Eq(0.0, -1.0));
        }
        // Token: 0x0600022E RID: 558 RVA: 0x0000F4DC File Offset: 0x0000D6DC
        protected short GetUnitechnikAngleOfFreeForm(ItGeCurve3d first, out ItGeVector3d normal)
        {
            ItGeVector3d directionFromCurve = SteelGroupElementRebarBase.GetDirectionFromCurve(first);
            double       num = ItGeVector3d.kXAxis.angleTo(directionFromCurve, ItGeVector3d.kZAxis);

            normal = ItGeVector3d.kYAxis.rotateBy(num, ItGeVector3d.kZAxis);
            num    = SteelGroupElement.FixAngleRange(num, false);
            num    = ItAngle.toDegree(num);
            return((short)Math.Round(num, 0));
        }
        // Token: 0x0600020E RID: 526 RVA: 0x0000E48C File Offset: 0x0000C68C
        private void GetRotationsSimple(ItGeVector3d rebarPlaneNormal, ItSegment prevSegment, ItGeVector3d direction, ref bool flipFutureYs, out double rotX, out double bendY)
        {
            ItGeVector3d xvector = prevSegment.XVector;
            ItGeVector3d yvector = prevSegment.YVector;

            rotX = yvector.angleTo(rebarPlaneNormal, xvector);
            rotX = SteelGroupElementRebarBase.FixRotX(rotX, ref flipFutureYs);
            ItGeVector3d refVec = new ItGeVector3d(yvector).rotateBy(rotX, xvector);

            bendY = xvector.angleTo(direction, refVec);
            bendY = SteelGroupElement.FixAngleRange(bendY, flipFutureYs);
        }
        // Token: 0x0600020D RID: 525 RVA: 0x0000E42C File Offset: 0x0000C62C
        private void GetRotationComplex(ItGeVector3d rebarPlaneNormal, ItSegment prevSegment, ItGeVector3d direction, ref bool flipFutureYs, out double rotX, out double bendY)
        {
            ItGeVector3d xvector       = prevSegment.XVector;
            ItGeVector3d yvector       = prevSegment.YVector;
            ItGeVector3d itGeVector3d  = yvector.orthoProject(rebarPlaneNormal);
            ItGeVector3d itGeVector3d2 = direction.crossProduct(rebarPlaneNormal);

            rotX  = itGeVector3d.angleTo(itGeVector3d2, xvector);
            rotX  = SteelGroupElementRebarBase.FixRotX(rotX, ref flipFutureYs);
            bendY = xvector.angleTo(direction, itGeVector3d2);
            bendY = SteelGroupElement.FixAngleRange(bendY, flipFutureYs);
        }
        // Token: 0x060001D8 RID: 472 RVA: 0x0000CA88 File Offset: 0x0000AC88
        private void UnitechnikWriteRebarAsFreeForm()
        {
            ItDebug.assert(base.IronSetsSchematic.any <List <ItGeCurve3d> >() && base.IronSetsSchematic[0].Count > 1, "Do not call this method for anything but bending forms.");
            ItUniWrapperImpl.RodstockData data = default(ItUniWrapperImpl.RodstockData);
            List <ItGeCurve3d>            list = base.IronSetsSchematic[0];
            ItGeVector3d normal;
            short        unitechnikAngleOfFreeForm = base.GetUnitechnikAngleOfFreeForm(list[0], out normal);
            int          num;
            double       dValue;

            this.GetSpacingAndCountForUnitechnik(unitechnikAngleOfFreeForm, out num, out dValue);
            int         freeFormLength = SteelGroupElementRebar.GetFreeFormLength(list);
            ItGePoint3d startPoint     = base.GetStartPoint(base.IronSetsSchematic);

            data.length              = (uint)freeFormLength;
            data.startAngle          = unitechnikAngleOfFreeForm;
            data.artNr               = string.Empty;
            data.autoProd            = 0;
            data.diameter            = (ushort)CNCDataBase.convertToMM(base.RebarBarType.BarDiameter);
            data.flexFormNumber      = 0;
            data.formType            = 2;
            data.hasSpacers          = 0;
            data.hasWielding         = 0;
            data.installationHeight  = (uint)CNCDataBase.convertToMM(startPoint.z);
            data.number              = (ushort)num;
            data.pitch               = CNCDataBase.convertToMM(dValue);
            data.pitchSpacer         = 0u;
            data.startingPointSpacer = 0u;
            data.reinfType           = (byte)base.CNCReinfTypeValue;
            data.steelQuality        = SteelGroupElementRebarBase.GetSteelQuality(base.RebarBarType);
            data.xcoord              = CNCDataBase.convertToMM(startPoint.x);
            data.ycoord              = CNCDataBase.convertToMM(startPoint.y);
            List <ItUniWrapperImpl.FreeFormSegment> list2 = new List <ItUniWrapperImpl.FreeFormSegment>();
            int num2;

            for (int i = 0; i < list.Count; i = num2 + 1)
            {
                ItGeCurve3d itGeCurve3d = list[i];
                ItGeCurve3d nextCurve   = list.ElementAtOrDefault(i + 1);
                short       unitechnikAngleOfNextSegment = this.GetUnitechnikAngleOfNextSegment(itGeCurve3d, nextCurve, normal);
                list2.Add(new ItUniWrapperImpl.FreeFormSegment
                {
                    length = (uint)CNCDataBase.convertToMM(itGeCurve3d.len),
                    angle  = unitechnikAngleOfNextSegment
                });
                num2 = i;
            }
            ItUniWrapperImpl.AddFreeFormRodstock(data, list2);
        }
 // Token: 0x06000203 RID: 515 RVA: 0x0000DE84 File Offset: 0x0000C084
 private ItBar CreateBarElement(ItGePoint3d startPoint, double rotZ)
 {
     return(new ItBar
     {
         ShapeMode = ShapeMode.realistic,
         ReinforcementType = base.CNCReinfTypeValue,
         SteelQuality = SteelGroupElementRebarBase.GetSteelQuality(this.RebarBarType),
         PieceCount = 1,
         Diameter = this.RebarBarType.BarDiameter,
         X = startPoint.x,
         Y = startPoint.y,
         Z = startPoint.z,
         RotZ = rotZ,
         CurrentNormal = ItGeVector3d.kYAxis
     });
 }
        // Token: 0x0600022C RID: 556 RVA: 0x0000F41C File Offset: 0x0000D61C
        protected bool IsMainAxis()
        {
            bool flag = this.IronSetsSchematic.none <List <ItGeCurve3d> >() || this.IronSetsSchematic[0].none <ItGeCurve3d>();
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                ItGeVector3d directionFromCurve = SteelGroupElementRebarBase.GetDirectionFromCurve(this.IronSetsSchematic[0][0]);
                result = (directionFromCurve.isParallelTo(ItGeVector3d.kXAxis, null) || directionFromCurve.isParallelTo(ItGeVector3d.kYAxis, null));
            }
            return(result);
        }
        // Token: 0x060001D9 RID: 473 RVA: 0x0000CC6C File Offset: 0x0000AE6C
        private short GetUnitechnikAngleOfNextSegment(ItGeCurve3d thisCurve, ItGeCurve3d nextCurve, ItGeVector3d normal)
        {
            bool  flag = nextCurve == null;
            short result;

            if (flag)
            {
                result = 0;
            }
            else
            {
                ItGeVector3d directionFromCurve  = SteelGroupElementRebarBase.GetDirectionFromCurve(thisCurve);
                ItGeVector3d directionFromCurve2 = SteelGroupElementRebarBase.GetDirectionFromCurve(nextCurve);
                double       num = directionFromCurve.angleTo(directionFromCurve2, normal);
                num = SteelGroupElement.FixAngleRange(num, false);
                num = ItAngle.toDegree(num);
                short num2 = (short)Math.Round(num, 0);
                result = num2;
            }
            return(result);
        }
        // Token: 0x06000201 RID: 513 RVA: 0x0000DD94 File Offset: 0x0000BF94
        public List <ItBar> ToBarList(ItSteel steelBlock, List <List <ItGeCurve3d> > ironSet)
        {
            List <ItBar> list = new List <ItBar>();
            bool         flag = ironSet.none <List <ItGeCurve3d> >();
            List <ItBar> result;

            if (flag)
            {
                result = list;
            }
            else
            {
                bool flag2 = this.RebarBarType == null;
                if (flag2)
                {
                    result = list;
                }
                else
                {
                    foreach (List <ItGeCurve3d> list2 in ironSet)
                    {
                        bool flag3 = list2.none <ItGeCurve3d>();
                        if (!flag3)
                        {
                            double      rotZ            = 0.0;
                            ItGeCurve3d firstSeg        = list2.FirstOrDefault <ItGeCurve3d>();
                            ItGePoint3d rebarStartPoint = SteelGroupElementRebarBase.GetRebarStartPoint(firstSeg);
                            ItGePoint3d startPoint      = steelBlock.Offset(rebarStartPoint);
                            ItBar       itBar           = this.CreateBarElement(startPoint, rotZ);
                            this.FillSegments(itBar, list2);
                            list.Add(itBar);
                        }
                    }
                    result = list;
                }
            }
            return(result);
        }
        // Token: 0x06000213 RID: 531 RVA: 0x0000E800 File Offset: 0x0000CA00
        public static ItGeVector3d GetNormalFromFirstTwoSegments(List <ItGeCurve3d> rebarList, ItGeVector3d defaultValue)
        {
            bool         flag = rebarList.Count < 2;
            ItGeVector3d result;

            if (flag)
            {
                result = defaultValue;
            }
            else
            {
                ItGeCircArc3d itGeCircArc3d = rebarList[0] as ItGeCircArc3d;
                ItGeLineSeg3d firstCurve    = rebarList[0] as ItGeLineSeg3d;
                bool          flag2         = itGeCircArc3d != null;
                if (flag2)
                {
                    result = itGeCircArc3d.normal();
                }
                else
                {
                    int num;
                    for (int i = 1; i < rebarList.Count; i = num + 1)
                    {
                        ItGeCurve3d  nextCurve             = rebarList[i];
                        ItGeVector3d normalFromTwoSegments = SteelGroupElementRebarBase.GetNormalFromTwoSegments(firstCurve, nextCurve);
                        bool         flag3 = normalFromTwoSegments != null;
                        if (flag3)
                        {
                            return(normalFromTwoSegments);
                        }
                        num = i;
                    }
                    result = ItGeVector3d.kYAxis;
                }
            }
            return(result);
        }
        // Token: 0x060001E0 RID: 480 RVA: 0x0000D164 File Offset: 0x0000B364
        private static bool IsValidBendingFormForUnitechnikFreeForm(List <List <ItGeCurve3d> > arrayIrons)
        {
            bool flag  = arrayIrons.any <List <ItGeCurve3d> >();
            bool flag2 = !flag;
            bool result;

            if (flag2)
            {
                result = false;
            }
            else
            {
                ItGeCurve3d curve;
                flag = arrayIrons.All(delegate(List <ItGeCurve3d> curves)
                {
                    bool result2 = false;
                    if (curves.any <ItGeCurve3d>())
                    {
                        //	result2 = curves.All((ItGeCurve3d curve) => curve is ItGeLineSeg3d);
                    }
                    else
                    {
                        result2 = false;
                    }
                    return(result2);
                });
                bool flag3 = !flag;
                if (flag3)
                {
                    result = false;
                }
                else
                {
                    flag = !SteelGroupElementRebar.IsSingleSegment(arrayIrons);
                    bool flag4 = !flag;
                    if (flag4)
                    {
                        result = false;
                    }
                    else
                    {
                        bool flag5 = arrayIrons.Count > 1;
                        if (flag5)
                        {
                            //SteelGroupElementRebar.<>c__DisplayClass19_1 CS$<>8__locals1 = new SteelGroupElementRebar.<>c__DisplayClass19_1();
                            //List<List<double>> list4 = (from curves in arrayIrons
                            //select (from curve in curves
                            //select curve.len).ToList<double>()).ToList<List<double>>();
                            //CS$<>8__locals1.firstLengths = list4[0];
                            //int j;
                            //int k;
                            //for (k = 0; k < CS$<>8__locals1.firstLengths.Count; k = j + 1)
                            //{
                            //	flag = list4.All((List<double> list) => list[k].Eq(CS$<>8__locals1.firstLengths[k], -1.0));
                            //	bool flag6 = !flag;
                            //	if (flag6)
                            //	{
                            //		return false;
                            //	}
                            //	j = k;
                            //}
                            //List<List<ItGeVector3d>> list2 = (from curves in arrayIrons
                            //select curves.Select(new Func<ItGeCurve3d, ItGeVector3d>(SteelGroupElementRebarBase.GetDirectionFromCurve)).ToList<ItGeVector3d>()).ToList<List<ItGeVector3d>>();
                            //CS$<>8__locals1.firstDirections = list2[0];
                            //int i;
                            //for (i = 0; i < CS$<>8__locals1.firstDirections.Count; i = j + 1)
                            //{
                            //	flag = list2.All((List<ItGeVector3d> list) => list[i].isCodirectionalTo(CS$<>8__locals1.firstDirections[i], null));
                            //	bool flag7 = !flag;
                            //	if (flag7)
                            //	{
                            //		return false;
                            //	}
                            //	j = i;
                            //}
                        }
                        ItGeVector3d itGeVector3d = null;
                        itGeVector3d = SteelGroupElementRebarBase.GetNormalFromFirstTwoSegments(arrayIrons.First <List <ItGeCurve3d> >(), ItGeVector3d.kZAxis);
                        flag         = itGeVector3d.z.Eq(0.0, -1.0);
                        bool flag8 = !flag;
                        if (flag8)
                        {
                            result = false;
                        }
                        else
                        {
                            foreach (List <ItGeCurve3d> list3 in arrayIrons)
                            {
                                ItGeCurve3d firstCurve = list3[0];
                                foreach (ItGeCurve3d itGeCurve3d in list3)
                                {
                                    ItGeCurve3d  itGeCurve3d2          = itGeCurve3d;
                                    ItGeVector3d normalFromTwoSegments = SteelGroupElementRebarBase.GetNormalFromTwoSegments(firstCurve, itGeCurve3d2);
                                    flag = (normalFromTwoSegments == null || normalFromTwoSegments.isParallelTo(itGeVector3d, null));
                                    bool flag9 = !flag;
                                    if (flag9)
                                    {
                                        return(false);
                                    }
                                    firstCurve = itGeCurve3d2;
                                }
                            }
                            curve = arrayIrons[0][0];
                            ItGeVector3d directionFromCurve = SteelGroupElementRebarBase.GetDirectionFromCurve(curve);
                            bool         flag10             = directionFromCurve.dotProduct(ItGeVector3d.kZAxis).Ne(0.0, -1.0);
                            if (flag10)
                            {
                                ItGeCurve3d curve2 = arrayIrons[0].Last <ItGeCurve3d>();
                                directionFromCurve = SteelGroupElementRebarBase.GetDirectionFromCurve(curve2);
                                bool flag11 = directionFromCurve.dotProduct(ItGeVector3d.kZAxis).Ne(0.0, -1.0);
                                if (flag11)
                                {
                                    return(false);
                                }
                                arrayIrons.ForEach(delegate(List <ItGeCurve3d> list)
                                {
                                    list.Reverse();
                                });
                                arrayIrons.ForEach(delegate(List <ItGeCurve3d> list)
                                {
                                    //list.ForEach(delegate(ItGeCurve3d curve)
                                    //{
                                    //	curve.reverseParam();
                                    //});
                                });
                            }
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
        // Token: 0x06000221 RID: 545 RVA: 0x0000EEA0 File Offset: 0x0000D0A0
        protected void UnitechnikAddStraightBars(List <List <ItGeCurve3d> > arrayIrons, ElementId id)
        {
            List <ItGeCurve3d> list = arrayIrons.FirstOrDefault <List <ItGeCurve3d> >();
            bool flag = list == null;

            if (flag)
            {
                ItFailures.PostFailure(ItFailures.CAMObjectWithoutValidGeometry, id);
            }
            else
            {
                ItGeCurve3d itGeCurve3d = list.FirstOrDefault <ItGeCurve3d>();
                bool        flag2       = itGeCurve3d == null;
                if (flag2)
                {
                    ItFailures.PostFailure(ItFailures.CAMObjectWithoutValidGeometry, id);
                }
                else
                {
                    ItGePoint3d itGePoint3d;
                    itGeCurve3d.hasStartPoint(out itGePoint3d);
                    ItGeVector3d itGeVector3d;
                    short        unitechnikAngleOfFreeForm = this.GetUnitechnikAngleOfFreeForm(itGeCurve3d, out itGeVector3d);
                    bool         flag3 = arrayIrons.Count > 1;
                    int          num;
                    double       num2;
                    if (flag3)
                    {
                        this.GetSpacingAndCountForUnitechnik(unitechnikAngleOfFreeForm, out num, out num2);
                    }
                    else
                    {
                        ItGeVector3d kOrigin = ItGeVector3d.kOrigin;
                        num2 = 0.0;
                        num  = 1;
                    }
                    uint length = (uint)CNCDataBase.convertToMM(itGeCurve3d.len);
                    ItUniWrapperImpl.RodstockData data = new ItUniWrapperImpl.RodstockData
                    {
                        length              = length,
                        startAngle          = unitechnikAngleOfFreeForm,
                        artNr               = string.Empty,
                        autoProd            = 0,
                        diameter            = (ushort)CNCDataBase.convertToMM(this.RebarBarType.BarDiameter),
                        flexFormNumber      = 0,
                        formType            = 0,
                        hasSpacers          = 0,
                        hasWielding         = 0,
                        pitchSpacer         = 0u,
                        startingPointSpacer = 0u,
                        reinfType           = (byte)base.CNCReinfTypeValue,
                        steelQuality        = SteelGroupElementRebarBase.GetSteelQuality(this.RebarBarType),
                        xcoord              = CNCDataBase.convertToMM(itGePoint3d.x),
                        ycoord              = CNCDataBase.convertToMM(itGePoint3d.y),
                        installationHeight  = (uint)CNCDataBase.convertToMM(itGePoint3d.z),
                        number              = (ushort)(num2.Ne(0.0, -1.0) ? num : 1),
                        pitch               = CNCDataBase.convertToMM(num2)
                    };
                    ItUniWrapperImpl.AddStraightRodstock(data);
                    bool flag4 = num2.Eq(0.0, -1.0) && num > 1;
                    if (flag4)
                    {
                        int num3;
                        for (int i = 1; i < arrayIrons.Count; i = num3 + 1)
                        {
                            itGeCurve3d = arrayIrons[i].FirstOrDefault <ItGeCurve3d>();
                            bool flag5 = itGeCurve3d == null;
                            if (!flag5)
                            {
                                itGeCurve3d.hasStartPoint(out itGePoint3d);
                                data.xcoord = CNCDataBase.convertToMM(itGePoint3d.x);
                                data.ycoord = CNCDataBase.convertToMM(itGePoint3d.y);
                                ItUniWrapperImpl.AddStraightRodstock(data);
                            }
                            num3 = i;
                        }
                    }
                }
            }
        }