Exemplo n.º 1
0
 private static void appendPointDefinition(StringBuilder sb, SectionPoint pt, double uFac)
 {
     if (pt != null)
     {
         sb.AppendLine("VERT " + pt.Id + " " + pt.Y * uFac + " " + pt.Z * uFac);
     }
 }
Exemplo n.º 2
0
        public static Section CreateSection(Brep brp, Plane pln)
        {
            var    sec = new Section();
            string id  = "P101";

            var tx = Transform.ChangeBasis(Plane.WorldYZ, Util.SofiSectionBasePlane) * Transform.ChangeBasis(Plane.WorldXY, pln);

            int pointIndex = 0;

            foreach (var lp in brp.Loops)
            {
                var crv = lp.To3dCurve();

                crv.Transform(tx);

                var polyLine = Util.CreatePolyLine(crv);
                if (polyLine != null)
                {
                    var secLp = new SectionLoop();
                    secLp.Type = lp.LoopType == BrepLoopType.Outer ? SectionLoopType.Outer : SectionLoopType.Inner;
                    int firstIndex = -1;
                    int i          = 0;
                    foreach (var pt in polyLine)
                    {
                        if (i < polyLine.Count - 1)
                        {
                            var secPt = new SectionPoint()
                            {
                                Id    = id,
                                EType = EdgeTransitionType.Fillet,
                                EdgeTransitionValue1 = 0.0,
                                EdgeTransitionValue2 = 0.0,
                                Y = pt.Y,
                                Z = pt.Z,
                            };
                            id = Util.CountStringUp(id);

                            if (i++ == 0)
                            {
                                firstIndex = pointIndex;
                            }
                            secLp.Add(pointIndex++);
                            sec.Points.Add(secPt);
                        }
                    }
                    if (firstIndex > -1)
                    {
                        secLp.Add(firstIndex);
                    }
                    sec.Loops.Add(secLp);
                }
            }

            return(sec);
        }