Example #1
0
        public Cluster()
            : base(entTypes.Sketch)
        {
            if (I.aDoc().DocumentType != DocumentTypeEnum.kPartDocumentObject)
            {
                return;
            }
            MyXML  xmlInterface = new MyXML("ClusterInterface.xml");
            MyForm F            = new MyForm(xmlInterface, "Кластер");

            F.f.ShowDialog();
            if (F.xmls.Count != 2)
            {
                return;
            }
            xml = F.xmls[1];
            Dictionary <string, string> dic = new Dictionary <string, string>();

            xml.set("val", F.cbs[0].Text);
            ClusterData.startx = 0; ClusterData.starty = 0;
            xml.getInt("countX", ref ClusterData.countX); xml.getInt("countY", ref ClusterData.countY);
            xml.getDouble("D", ref ClusterData.D, ClusterData.tol); xml.getDouble("dx", ref ClusterData.dx, ClusterData.tol);
            xml.getDouble("dy", ref ClusterData.dy, ClusterData.tol);  xml.getInt("rotate", ref ClusterData.rotate);
            foreach (var item in xml.elem.Elements())
            {
                data.Add(new ClusterData(new MyXML(item)));
            }
//             if (ClusterData.rotate == 1)
//             {
//                 data.Insert(0, data[1]);
//                 data.Remove(data[2]);
//             }
            doc     = I.aDoc() as PartDocument;
            compDef = doc.ComponentDefinition;
            ps      = compDef.Sketches[compDef.Sketches.Count];
            if (ps.Consumed)
            {
                return;
            }
            psOut             = compDef.Sketches.Add(ps.PlanarEntity);
            psOut.OriginPoint = ps.OriginPoint;
            if (ps.AxisEntity != null)
            {
                psOut.AxisEntity = ps.AxisEntity;
            }
            psOut.AxisIsX = ps.AxisIsX;
            psOut.NaturalAxisDirection = ps.NaturalAxisDirection;
            get();
        }