public static List <Luminaire> Luminaire(this ICurve crv, int count, Vector dir, LuminaireType type = null, string name = "") { List <Luminaire> luminaires = new List <Luminaire>(); List <Point> pts = crv.SamplePoints(count); for (int i = 0; i < pts.Count; i++) { Luminaire lum = Create.Luminaire(pts[i], dir, type, name + "_" + i.ToString()); luminaires.Add(lum); } return(luminaires); }
public static Luminaire Luminaire(this Point pt, Vector orientation = null, LuminaireType type = null, string name = "") { Luminaire luminaire = new Luminaire { Position = pt, Direction = orientation, LuminaireType = type, Name = name }; return(luminaire); }
public static Luminaire Transform(this Luminaire luminaire, TransformMatrix transform, double tolerance = Tolerance.Distance) { if (!transform.IsRigidTransformation(tolerance)) { BH.Engine.Reflection.Compute.RecordError("Transformation failed: only rigid body transformations are currently supported."); return(null); } Luminaire result = luminaire.ShallowClone(); result.Position = result.Position.Transform(transform); result.Direction = result.Direction.Transform(transform); return(result); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { //this.propertyGrid1.SelectedObject = e.Node.Tag; if (e.Node.Tag == null) { return; } if (e.Node.Tag is API.Area) { API.Area area = e.Node.Tag as API.Area; this.txtArea.Text = area.areaID.ToString(); this.txt_Luminaire.Text = ""; this.groupBox1.Visible = true; if (e.Node.Nodes.Count == 0) { ExpandArea(e.Node, e.Node.Tag as API.Area); } cmb_AreaOff.Items.Clear(); cmb_AreaOn.Items.Clear(); AreaLevel[] levels = PhilipsRestApi.GetAreaLevels(area.areaID); foreach (AreaLevel lvl in levels) { cmb_AreaOff.Items.Add(lvl); cmb_AreaOn.Items.Add(lvl); } } else if (e.Node.Tag is Luminaire) { this.groupBox1.Visible = false; Luminaire lum = e.Node.Tag as Luminaire; API.Area area = e.Node.Parent.Tag as API.Area; this.txtArea.Text = area.areaID.ToString(); this.txt_Luminaire.Text = lum.luminaireID.ToString(); } }