Ejemplo n.º 1
0
        public void InsertTrafficLight()
        {
            //validar la carga de la interfaz
            if (this.ctrl_blockTab == null)
                return;
            String pthTL = System.IO.Path.Combine(this.ctrl_blockTab.Directory_Path, "trafficLight.dwg");
            String pthTLI = System.IO.Path.Combine(this.ctrl_blockTab.Directory_Path, "trafficLightIndicator.dwg");

            if (File.Exists(pthTL) && File.Exists(pthTLI))
            {
                BlockManager blkManTL = new BlockManager(pthTL);
                BlockManager blkManTLI = new BlockManager(pthTLI);
                Point3d pos;
                if (Selector.Point("Select the point to insert the Traffic Light (Point3D)", out pos))
                {
                    blkManTL.Load("TL"+this.semaforosCounter.ToString("D3"));
                    blkManTLI.Load("TLI" + this.semaforosCounter.ToString("D3"));
                    //
                    ObjectId idTLI = blkManTLI.Insert(Point3d.Origin);
                    pos = new Point3d(pos.X, pos.Y, float.Parse(StringNull( this.ctrl_blockTab.tbZpos.Text) ));
                    ObjectId idTL = blkManTL.Insert( pos );
                    this.semaforos.Add( new Semaforo( ref idTL, semaforos.Count,int.Parse(StringNull( this.ctrl_blockTab.tbStopGo.Text )), int.Parse( StringNull( this.ctrl_blockTab.tbCaution.Text) ), ref idTLI));
                    semaforosCounter++;
                    //
                    this.ctrl_blockTab.PrintValues(this.moviles, this.semaforos, this.paths);
                }
            }
        }
Ejemplo n.º 2
0
        public void InsertVehicle()
        {
            //validar la carga de la interfaz
            if (this.ctrl_blockTab == null)
                return;
            String pth = System.IO.Path.Combine(this.ctrl_blockTab.Directory_Path,
                "vehicle.dwg");

            if (File.Exists(pth))
            {
                BlockManager blkMan = new BlockManager(pth);
                ObjectId rutaId;
                if (Selector.ObjectId("Select the Path to insert the Vehicle (Polyline)", "", typeof(Polyline), out rutaId))
                {
                    AddPath(rutaId);
                    blkMan.Load("V"+this.movilesCounter.ToString("D3"));
                    ObjectId id = blkMan.Insert(Point3d.Origin);
                    AttributeManager attMan = new AttributeManager(id);
                    //
                    this.moviles.Add(new Movil(ref rutaId, ref id, double.Parse(StringNull(this.ctrl_blockTab.tbMin.Text)), double.Parse(StringNull(this.ctrl_blockTab.tbMax.Text)), this.ctrl_blockTab.cbLoopTravel.Checked));
                    this.movilesCounter++;
                    attMan.SetAttribute("ID", "V" + this.moviles.Count);
                    //
                    this.ctrl_blockTab.PrintValues(this.moviles, this.semaforos, this.paths);
                }
            }
        }
Ejemplo n.º 3
0
 public void InsertAnd()
 {
     Point3d insPt;
     if (Lab2.Selector.Point("\nPunto de inserción", out insPt))
     {
         String dllPath =
         System.Reflection.Assembly.GetAssembly(typeof(Commands)).Location;
         String dir = dllPath.Substring(0, dllPath.LastIndexOf('\\'));
         string file = Path.Combine(dir, "Bloques", "AND.dwg");
         BlockManager blkMan;
         blkMan = new BlockManager(file);
         try
         {
             blkMan.Load("AND");
             ObjectId refId = blkMan.Insert(insPt);
             blkMan.CreateBBox(refId);
             //Dibujar las cajas
             DBMan.DrawGeometry(blkMan.Box.Geometry, true);
             DBMan.DrawGeometry(blkMan.BoxInputA.Geometry, true);
             DBMan.DrawGeometry(blkMan.BoxInputB.Geometry, true);
             DBMan.DrawGeometry(blkMan.BoxOutput.Geometry, true);
         }
         catch (System.Exception e)
         {
             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
             ed.WriteMessage("\n", e.Message);
         }
     }
 }