public void InsertCompuerta() { //validar la carga de la interfaz if (ctrl_blockTab == null) return; String pth = System.IO.Path.Combine(ctrl_blockTab.Directory_Path, this.ctrl_blockTab.Blockname); if (File.Exists(pth)) { Lab3.BlockManager blkMan = new Lab3.BlockManager(pth); Point3d pt; if (Lab2.Selector.Point("Selecciona el punto de inserción", out pt)) { blkMan.Load("Compuerta"); ObjectId id = blkMan.Insert(pt); AttributeManager attMan = new AttributeManager(id); attMan.SetAttribute("InputA", "1,1,0,0"); attMan.SetAttribute("InputB", "1,0,1,0"); attMan.SetAttribute("OUTPUT", "1,0,0,0"); String strA = attMan.GetAttribute("InputA"); } } else { } }
public void SetAttribute_EmptySelection() { _selection .As <IEnumerable>() .Setup(mock => mock.GetEnumerator()) .Returns(new List <IEntity>().GetEnumerator()); _attributes.SetAttribute("test", new Attribute("test", new StringValue("value"), AttributeSource.Custom)); _entityManager.Verify(mock => mock.SetEntity(It.IsAny <IEntity>(), true), Times.Never); }
// public Movil(ref ObjectId line, ref ObjectId mobile, double minSeparation, double maxSeparation, bool loopTravel) { this.line = line; this.mobile = mobile; this.dPromMin = minSeparation; this.dPromMax = maxSeparation; this.loopTravel = loopTravel; this.goal = false; this.ruta = Lab3.DBMan.OpenEnity(line) as Polyline; this.bloque = Lab3.DBMan.OpenEnity(mobile) as BlockReference; this.bloqueCentro = new Point3d((bloque.GeometricExtents.MinPoint.X + bloque.GeometricExtents.MaxPoint.X) / 2, (bloque.GeometricExtents.MinPoint.Y + bloque.GeometricExtents.MaxPoint.Y) / 2, 0); this.numeroSegmentos = this.ruta.NumberOfVertices - 1; this.segmentoActualIndex = 0; this.segmentoActual = this.ruta.GetLineSegment2dAt(segmentoActualIndex); Lab3.DBMan.UpdateBlockPosition(new Point3d(this.segmentoActual.StartPoint.X, this.segmentoActual.StartPoint.Y, 0), mobile); // AttributeManager attribute = new AttributeManager(mobile); attribute.SetAttribute("Velocity", this.velocity+" [Kms/hr]"); // this.pointActualCurve = 0; this.velocityScale = 0.00001f; this.velocity = this.UpdateDireccion(); Lab3.DBMan.UpdateBlockRotation(new Vector2d(this.velocity.X, this.velocity.Y).Angle, this.mobile); }
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); } } }
/// <summary> /// Establece el resultado de las entradas /// </summary> public void Solve() { String inputA = FindTextInputA(), inputB = FindTextInputB(), output = String.Empty; if (inputA.Length == inputB.Length && inputA.Length == 1) output = this.GetOutput(inputA, inputB, this.Name) ? "1" : "0"; else if (inputA.Length == inputB.Length) { string[] a = inputA.Split(','), b = inputB.Split(','); for (int i = 0; i < a.Length; i++) output += this.GetOutput(a[i], b[i], this.Name) ? "1" : "0"; } else if (inputA.Length > inputB.Length && inputB.Length == 1) { string[] a = inputA.Split(','); for (int i = 0; i < a.Length; i++) output += this.GetOutput(a[i], inputB, this.Name) ? "1" : "0"; } else if (inputA.Length < inputB.Length && inputA.Length == 1) { string[] b = inputB.Split(','); for (int i = 0; i < b.Length; i++) output += this.GetOutput(inputA, b[i], this.Name) ? "1" : "0"; } else { string[] a = inputA.Split(','), b = inputB.Split(','); for (int i = 0, j = 0; i < a.Length && j < b.Length; i++, j++) { if (i < a.Length && j < b.Length) output += this.GetOutput(a[i], b[j], this.Name) ? "1" : "0"; else if (i < a.Length && j > b.Length) output += this.GetOutput(a[i], b[b.Length - 1], this.Name) ? "1" : "0"; else if (i < a.Length && j > b.Length) output += this.GetOutput(a[a.Length - 1], b[j], this.Name) ? "1" : "0"; } } AttributeManager attMan = new AttributeManager(this.Id); if (this.Name == "NOT") attMan.SetAttribute("INPUT", inputA); else { attMan.SetAttribute("INPUTA", inputA.Replace(",", "")); attMan.SetAttribute("INPUTB", inputB.Replace(",", "")); } attMan.SetAttribute("OUTPUT", output); }