Пример #1
0
        public static void Connect(Transaction tr, Document doc, Dictionary <Handle, Compuerta> compuertas)
        {
            ObjectId pulsoId, cmpId;
            Point3d  connPoint;

            if (Selector.Entity("Selecciona un pulso", typeof(Polyline), out pulsoId) &&
                Selector.Entity("Selecciona la compuerta a conectar el pulso", out cmpId, out connPoint))
            {
                Cable c;
                //Extraer información del pulso
                Polyline  pl    = pulsoId.GetObject(OpenMode.ForRead) as Polyline;
                Boolean[] data  = Pulso.GetValues(pl);
                Point3d   start = pl.EndPoint;
                //Extraer información de la compuerta
                Compuerta cmp = compuertas.Values.FirstOrDefault(x => x.Block.Id == cmpId);
                if (cmp != null)
                {
                    String            name;
                    Point3dCollection zone;
                    cmp.GetZone(connPoint, out name, out zone);
                    //Obtención del punto de conexión
                    if (cmp.ConnectionPoints.ContainsKey(name))
                    {
                        Point3d end = cmp.ConnectionPoints[name];
                        Drawer  d   = new Drawer(tr);
                        c = Cable.InsertCable(start, end, d);
                        c.SetData(tr, doc, data);
                    }
                }
            }
        }
Пример #2
0
        public static Cable InsertCable(Point3d start, Point3d end, Drawer d)
        {
            Cable c = new Cable(start, end);

            d.Entity(c.Geometry);
            return(c);
        }