protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); int teeID = Intent.GetIntExtra("TeeID", 0); if (teeID > 0) { tee = TeeManager.GetTee(teeID); } // set our layout to be the home screen SetContentView(Resource.Layout.TeeDetails_Layout); // find all our controls teeTextEdit = FindViewById <EditText>(Resource.Id.TeesDetail_EditText_TeeValue); deleteButton = FindViewById <Button>(Resource.Id.TeesDetail_Button_Delete); saveButton = FindViewById <Button>(Resource.Id.TeesDetail_Button_Save); cancelButton = FindViewById <Button>(Resource.Id.TeesDetail_Button_Cancel); // set the teeTextEdit based on whether or not it's an existing tee that was long clicked. teeTextEdit.Text = (tee.ID == 0 ? "" : tee.TeeName); // button clicks cancelButton.Click += (sender, e) => { Cancel(); }; saveButton.Click += (sender, e) => { Save(); }; deleteButton.Click += (sender, e) => { Delete(); }; }
public List <Tee> GetTees() { List <Tee> tees = new List <Tee>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_GET_TEES, conn); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Tee tee = RowToObject(rdr); Course course = CourseSqlDAO.RowToObject(rdr); tee.Course = course; tees.Add(tee); } } return(tees); } catch (Exception ex) { throw; } }
public List <GolfRound> GetGolfRoundsByPlayerId(int playerId) { List <GolfRound> golfRounds = new List <GolfRound>(); try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_GET_GOLF_ROUNDS_BY_PLAYERID, conn); cmd.Parameters.AddWithValue("@playerId", playerId); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { GolfRound golfRound = RowToObject(rdr); Course course = CourseSqlDAO.RowToObject(rdr); Tee tee = TeeSqlDAO.RowToObject(rdr); tee.Course = course; golfRound.Tee = tee; golfRounds.Add(golfRound); } } return(golfRounds); } catch (SqlException ex) { throw; } }
public Replica(int id, bool isActive) : base(id) { Tee = new Tee(PrivateKey, PublicKey) { IsActive = isActive }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); courseTee = new CourseTee(); course = new Course(); selectedTee = new Tee(); course.CourseName = Intent.GetStringExtra("CourseName") ?? "Do data, why"; course.ID = Intent.GetIntExtra("CourseID", 0); numberOfHoles = Intent.GetIntExtra("CourseHoles", 0); courseTee.CourseID = course.ID; // set our layout to be the home screen SetContentView(Resource.Layout.CourseTeeDetails_Layout); // find all our controls yardsEditText = FindViewById <EditText>(Resource.Id.CourseTeeDetails_EditText_ReportedYards); saveButton = FindViewById <Button>(Resource.Id.CourseTeeDetails_Button_Save); teesSpinner = FindViewById <Spinner>(Resource.Id.CourseTeeDetails_Spinner_Tee); // set the cancel delete based on whether or not it's an existing task //cancelDeleteButton.Text = (task.ID == 0 ? "Cancel" : "Delete"); // button clicks saveButton.Click += (sender, e) => { Save(); }; teesSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); }
public TeeEditor(TeeControl teeCtrl) : base(teeCtrl) { // // Required for Windows Form Designer support // InitializeComponent(); this.Size = new Size(296, this.formHeight); this.FormBorderStyle = FormBorderStyle.Sizable; this.Text = "Tee"; this.panel.AutoScroll = true; Tee tee = this.TeeCtrl.Tee; this.Text = "Tee: " + tee.Name; this.userCtrlFractions = new UserControl(); this.userCtrlFractions.AutoScroll = true; this.userCtrlFractions.Size = new Size(242, this.groupBoxHeight - 40); this.userCtrlFractions.Location = new Point(4, 12 + 20 + 2); this.groupBoxStreams = new GroupBox(); this.groupBoxStreams.Text = "Inlet/Outlets"; this.groupBoxStreams.Location = new System.Drawing.Point(4, 24); this.groupBoxStreams.Size = new System.Drawing.Size(280, this.groupBoxHeight); this.panel.Controls.Add(this.groupBoxStreams); this.groupBoxFractions = new GroupBox(); this.groupBoxFractions.Text = "Outlet Fractions"; this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24); this.groupBoxFractions.Size = new System.Drawing.Size(250, this.groupBoxHeight); this.groupBoxFractions.Controls.Add(this.userCtrlFractions); this.panel.Controls.Add(this.groupBoxFractions); textBoxStreamInName = new ProsimoUI.SolvableNameTextBox(); this.outletControls = new Hashtable(); if (tee.Inlet is DryingGasStream) { this.formHeight = 368; this.groupBoxHeight = 280; this.ClientSize = new System.Drawing.Size(292, 253); } else if (tee.Inlet is DryingMaterialStream) { this.formHeight = 388; this.groupBoxHeight = 300; this.ClientSize = new System.Drawing.Size(292, 273); } this.groupBoxStreams.Size = new System.Drawing.Size(360, this.groupBoxHeight); this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24); this.groupBoxFractions.Size = new System.Drawing.Size(250, this.groupBoxHeight); this.UpdateTheUI(); teeCtrl.Tee.StreamAttached += new StreamAttachedEventHandler(Tee_StreamAttached); teeCtrl.Tee.StreamDetached += new StreamDetachedEventHandler(Tee_StreamDetached); }
public ActionResult DeleteConfirmed(int id) { Tee tee = db.Tees.Find(id); db.Tees.Remove(tee); db.SaveChanges(); return(RedirectToAction("Index")); }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Spinner spinner = (Spinner)sender; int pos = e.Position; selectedTee = tees.ElementAt <Tee>(pos); }
public AudioSinkBin(string elementName) : base(elementName) { hw_audio_sink = SelectAudioSink(); Add(hw_audio_sink); first = hw_audio_sink; // Our audio sink is a tee, so plugins can attach their own pipelines audiotee = ElementFactory.Make("tee", "audiotee") as Tee; if (audiotee == null) { Log.Error("Can not create audio tee!"); } else { Add(audiotee); } volume = FindVolumeProvider(hw_audio_sink); if (volume != null) { // If the sink provides its own volume property we assume that it will // also save that value across program runs. Pulsesink has this behaviour. VolumeNeedsSaving = false; } else { volume = ElementFactory.Make("volume", "volume"); VolumeNeedsSaving = true; Add(volume); volume.Link(hw_audio_sink); first = volume; } equalizer = ElementFactory.Make("equalizer-10bands", "equalizer-10bands"); if (equalizer != null) { Element eq_audioconvert = ElementFactory.Make("audioconvert", "audioconvert"); Element eq_audioconvert2 = ElementFactory.Make("audioconvert", "audioconvert2"); preamp = ElementFactory.Make("volume", "preamp"); Add(eq_audioconvert, preamp, equalizer, eq_audioconvert2); Element.Link(eq_audioconvert, preamp, equalizer, eq_audioconvert2, first); first = eq_audioconvert; Log.Debug("Built and linked Equalizer"); } // Link the first tee pad to the primary audio sink queue Pad sinkpad = first.GetStaticPad("sink"); Pad pad = audiotee.GetRequestPad("src%d"); audiotee.AllocPad = pad; pad.Link(sinkpad); first = audiotee; visible_sink = new GhostPad("sink", first.GetStaticPad("sink")); AddPad(visible_sink); }
public TeeControl(Flowsheet flowsheet, Point location, Tee tee) : base(flowsheet, location, tee) { InitializeComponent(); this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H); UI.SetStatusColor(this, this.Tee.SolveState); this.UpdateBackImage(); }
public ActionResult Edit([Bind(Include = "TeeId,CourseId,Name,Slope,Rating,Yardage")] Tee tee) { if (ModelState.IsValid) { db.Entry(tee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tee)); }
public HoleInfo(Game game, Tee tee, Vector3 frontTeePosition, Vector3 backTeePosition, Vector3 holePosition, int par) { this.tee = tee; this.frontTeePosition = frontTeePosition; this.backTeePosition = backTeePosition; this.holePosition = holePosition; CalculateHoleLength(); this.par = par; }
public ActionResult Create([Bind(Include = "TeeId,FacilityId,CourseId,Name,Slope,Rating,Yardage")] Tee tee) { if (ModelState.IsValid) { db.Tees.Add(tee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tee)); }
public static void ResetTee(Tee tee) { GameObject go = tee.gameObject; go.transform.SetParent(instance.transform); go.SetActive(false); instance.activeList.Remove(go); instance.inactiveList.Add(go); }
public ActionResult Edit([Bind(Include = "Id,Par,Name,Lenght,Scratch,Slope,GolfcourseId")] Tee tee) { if (ModelState.IsValid) { db.Entry(tee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GolfcourseId = new SelectList(db.Golfcourses, "Id", "Name", tee.GolfcourseId); return(View(tee)); }
public HoleInfo(Game game, Tee tee, Vector3 frontTeePosition, Vector3 backTeePosition, Vector3 holePosition) { this.game = game; this.tee = tee; this.frontTeePosition = frontTeePosition; this.backTeePosition = backTeePosition; this.holePosition = holePosition; CalculateHoleLength(); CalculatePar(); }
public ActionResult <Tee> GetTeeById(int id) { Tee tee = teeDAO.GetTeeWithHolesById(id); if (tee != null) { return(Ok(tee)); } else { return(BadRequest()); } }
// GET: Tees/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tee tee = db.Tees.Find(id); if (tee == null) { return(HttpNotFound()); } return(View(tee)); }
public string GetTees(int facilityId, int courseId) { var tees = db.Tees.Where(f => f.FacilityId == facilityId && f.CourseId == courseId).ToList(); var list = new List <Tee>(); foreach (Tee t in tees) { var teeObj = new Tee(); teeObj.TeeId = t.TeeId; teeObj.Name = t.Name; list.Add(teeObj); } return(JsonConvert.SerializeObject(list, Formatting.Indented, JsonSetting)); }
// GET: Tee/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Tee tee = db.Tees.Find(id); if (tee == null) { return(HttpNotFound()); } ViewBag.GolfcourseId = new SelectList(db.Golfcourses, "Id", "Name", tee.GolfcourseId); return(View(tee)); }
// TODO move this method out of UI private static Tee GetTeeByTeeId(List <Tee> tees, int teeId) { Tee output = null; foreach (Tee tee in tees) { if (tee.TeeId == teeId) { output = tee; return(output); } } return(null); }
public HoleData(string name, Tee tee, float lengthFront, float lengthBack, int par, float hcp) { this.name = name; this.tee = tee; this.lengthFront = lengthFront; this.lengthBack = lengthBack; this.par = par; this.hcp = hcp; strokes = 0; putts = 0; fir = false; gir = false; bunker = false; water = false; }
public void PipelineTest1() { string value = null; int tvalue = 0; var stage1 = new Stage <double, int>(d => (int)d); var stage2 = new Tee <int>(i => tvalue = i); var stage3 = new Stage <int, string>(i => (i * 10).ToString()); var stub = StubFiber.StartNew(); var pipeline = stage1.To(stage2).To(stage3); pipeline.Subscribe(stub, s => value = s); stage1.Publish(1.3); Thread.Sleep(10); Assert.AreEqual("10", value); Assert.AreEqual(1, tvalue); }
protected override void OnCreate(Bundle bundle) { try { base.OnCreate(bundle); // set our layout to be the home screen SetContentView(Resource.Layout.Tees_Layout); // find all our controls addTeeButton = FindViewById <Button>(Resource.Id.Tees_Button_AddTee); teeListView = FindViewById <ListView>(Resource.Id.Tees_ListView_TeeList); // wire up add task button handler if (addTeeButton != null) { addTeeButton.Click += (sender, e) => { StartActivity(typeof(TeeDetails_Code)); }; } //teeListView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs e) //{ // selectedFromList = tees[e.Position]; // var activity2 = new Intent(this, typeof(TeeDetails_Code)); // activity2.PutExtra("TeeID", selectedFromList.ID); // StartActivity(activity2); //}; teeListView.ItemLongClick += delegate(object sender, AdapterView.ItemLongClickEventArgs e) { selectedFromList = tees[e.Position]; var activity2 = new Intent(this, typeof(TeeDetails_Code)); activity2.PutExtra("TeeID", selectedFromList.ID); StartActivity(activity2); }; } catch (Exception ex) { } }
internal static Tee RowToObject(SqlDataReader rdr) { Tee tee = new Tee(); tee.TeeId = Convert.ToInt32(rdr["TeeId"]); tee.Name = Convert.ToString(rdr["Name"]); tee.RatingFull = Convert.ToDouble(rdr["RatingFull"]); tee.SlopeFull = Convert.ToInt32(rdr["SlopeFull"]); tee.RatingFront = Convert.ToDouble(rdr["RatingFront"]); tee.SlopeFront = Convert.ToInt32(rdr["SlopeFront"]); tee.RatingBack = Convert.ToDouble(rdr["RatingBack"]); tee.SlopeBack = Convert.ToInt32(rdr["SlopeBack"]); tee.Yardage = Convert.ToInt32(rdr["Yardage"]); tee.Course = null; return(tee); }
public GolfRound CreateGolfRound(GolfRound round) { GolfRound createdRound = null; try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_CREATE_GOLF_ROUND, conn); cmd.Parameters.AddWithValue("@playerId", round.PlayerId); cmd.Parameters.AddWithValue("@teeId", round.Tee.TeeId); cmd.Parameters.AddWithValue("@datePlayed", round.DatePlayed); cmd.Parameters.AddWithValue("@score", round.Score); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { Tee tee = TeeSqlDAO.RowToObject(rdr); Course course = CourseSqlDAO.RowToObject(rdr); createdRound = RowToObject(rdr); tee.Course = course; createdRound.Tee = tee; } rdr.Close(); if (round.HoleResults.Count > 0) { CreateHoleResults(conn, round, createdRound.GolfRoundId); } return(createdRound); } } catch (Exception ex) { throw; } }
public async Task Command_line_splitting(string command, params string[] expected) { var echo = typeof(TestEcho.Program).Assembly.Location; echo = echo.Replace(@"Source\Utility.Tests", @"Source\TestEcho"); var tee = new Tee(Log.Out); var process = Run($"dotnet '{echo}' {command}").With(tee); var result = await process; Assert.That(result.Success); Assert.That(tee.StandardError().Count, Is.EqualTo(0)); Assert.That(tee.StandardOutput().Count, Is.GreaterThan(0)); var count = int.Parse(tee.StandardOutput().First()); Assert.That(expected.Length, Is.EqualTo(count)); CollectionAssert.AreEqual(expected, tee.StandardOutput().Skip(1).Take(count)); }
public Player GetPlayerById(int playerId) { Player player = null; try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_GET_PLAYER_BY_ID, conn); cmd.Parameters.AddWithValue("@playerId", playerId); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { player = RowToObject(rdr); } if (rdr.NextResult()) { while (rdr.Read()) { GolfRound golfRound = GolfRoundSqlDAO.RowToObject(rdr); Tee tee = TeeSqlDAO.RowToObject(rdr); Course course = CourseSqlDAO.RowToObject(rdr); tee.Course = course; golfRound.Tee = tee; player.GolfRounds.Add(golfRound); } } return(player); } } catch (SqlException ex) { throw; } }
public Tee GetTeeWithHolesById(int teeId) { Tee tee = null; Course course = null; try { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(SQL_GET_TEE_WITH_HOLES_BY_ID, conn); cmd.Parameters.AddWithValue("@teeId", teeId); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { tee = TeeSqlDAO.RowToObject(rdr); course = CourseSqlDAO.RowToObject(rdr); tee.Course = course; } if (rdr.NextResult()) { while (rdr.Read()) { Hole hole = HoleSqlDAO.RowToObject(rdr); //hole.Course = course; course.Holes.Add(hole); } } } return(tee); } catch (Exception ex) { throw; } }
private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick) { if (!revitStick.IsEnabled()) { return(new Element1D()); } var speckleElement1D = new Element1D(); switch (revitStick.Category.Name) { case "Analytical Columns": speckleElement1D.type = ElementType1D.Column; break; case "Analytical Beams": speckleElement1D.type = ElementType1D.Beam; break; case "Analytical Braces": speckleElement1D.type = ElementType1D.Brace; break; default: speckleElement1D.type = ElementType1D.Other; break; } var curves = revitStick.GetCurves(AnalyticalCurveType.RigidLinkHead).ToList(); curves.AddRange(revitStick.GetCurves(AnalyticalCurveType.ActiveCurves)); curves.AddRange(revitStick.GetCurves(AnalyticalCurveType.RigidLinkTail)); if (curves.Count > 1) { speckleElement1D.baseLine = null; } else { speckleElement1D.baseLine = (Objects.Geometry.Line)CurveToSpeckle(curves[0]); } var coordinateSystem = revitStick.GetLocalCoordinateSystem(); if (coordinateSystem != null) { speckleElement1D.localAxis = new Geometry.Plane(PointToSpeckle(coordinateSystem.Origin), VectorToSpeckle(coordinateSystem.BasisZ), VectorToSpeckle(coordinateSystem.BasisX), VectorToSpeckle(coordinateSystem.BasisY)); } var startOffset = revitStick.GetOffset(AnalyticalElementSelector.StartOrBase); var endOffset = revitStick.GetOffset(AnalyticalElementSelector.EndOrTop); speckleElement1D.end1Offset = VectorToSpeckle(startOffset); speckleElement1D.end2Offset = VectorToSpeckle(endOffset); var startRelease = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_START_RELEASE_TYPE); var endRelease = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_END_RELEASE_TYPE); if (startRelease == 0) { speckleElement1D.end1Releases = new Restraint(RestraintType.Fixed); } else { var botReleaseX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FX) == 1 ? "R" : "F"; var botReleaseY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FY) == 1 ? "R" : "F"; var botReleaseZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FZ) == 1 ? "R" : "F"; var botReleaseXX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MX) == 1 ? "R" : "F"; var botReleaseYY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MY) == 1 ? "R" : "F"; var botReleaseZZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MZ) == 1 ? "R" : "F"; string botReleaseCode = botReleaseX + botReleaseY + botReleaseZ + botReleaseXX + botReleaseYY + botReleaseZZ; speckleElement1D.end1Releases = new Restraint(botReleaseCode); } if (endRelease == 0) { speckleElement1D.end2Releases = new Restraint(RestraintType.Fixed); } else { var topReleaseX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FX) == 1 ? "R" : "F"; var topReleaseY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FY) == 1 ? "R" : "F"; var topReleaseZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FZ) == 1 ? "R" : "F"; var topReleaseXX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MX) == 1 ? "R" : "F"; var topReleaseYY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MY) == 1 ? "R" : "F"; var topReleaseZZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MZ) == 1 ? "R" : "F"; string topReleaseCode = topReleaseX + topReleaseY + topReleaseZ + topReleaseXX + topReleaseYY + topReleaseZZ; speckleElement1D.end2Releases = new Restraint(topReleaseCode); } var prop = new Property1D(); var stickFamily = (Autodesk.Revit.DB.FamilyInstance)Doc.GetElement(revitStick.GetElementId()); var section = stickFamily.Symbol.GetStructuralSection(); var speckleSection = new SectionProfile(); speckleSection.name = section.StructuralSectionShapeName; switch (section.StructuralSectionGeneralShape) { case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralI: // Double T structural sections var ISection = new ISection(); ISection.name = section.StructuralSectionShapeName; ISection.shapeType = Structural.ShapeType.I; ISection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("Height").GetValue(section); ISection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("Width").GetValue(section); ISection.webThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("WebThickness").GetValue(section); ISection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("FlangeThickness").GetValue(section); ISection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("SectionArea").GetValue(section); ISection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("NominalWeight").GetValue(section); ISection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); ISection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); ISection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = ISection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralT: // Tees structural sections var teeSection = new Tee(); teeSection.name = section.StructuralSectionShapeName; teeSection.shapeType = Structural.ShapeType.I; teeSection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("Height").GetValue(section); teeSection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("Width").GetValue(section); teeSection.webThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("WebThickness").GetValue(section); teeSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("FlangeThickness").GetValue(section); teeSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("SectionArea").GetValue(section); teeSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("NominalWeight").GetValue(section); teeSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); teeSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); teeSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = teeSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralH: // Rectangular Pipe structural sections var rectSection = new Rectangular(); rectSection.name = section.StructuralSectionShapeName; rectSection.shapeType = Structural.ShapeType.I; rectSection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("Height").GetValue(section); rectSection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("Width").GetValue(section); var wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("WallNominalThickness").GetValue(section); rectSection.webThickness = wallThickness; rectSection.flangeThickness = wallThickness; rectSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("SectionArea").GetValue(section); rectSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("NominalWeight").GetValue(section); rectSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); rectSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); rectSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = rectSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralR: // Pipe structural sections var circSection = new Circular(); circSection.name = section.StructuralSectionShapeName; circSection.shapeType = Structural.ShapeType.Circular; circSection.radius = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("Diameter").GetValue(section) / 2; circSection.wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("WallNominalThickness").GetValue(section); circSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("SectionArea").GetValue(section); circSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("NominalWeight").GetValue(section); circSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); circSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); circSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = circSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralF: // Flat Bar structural sections var flatRectSection = new Rectangular(); flatRectSection.name = section.StructuralSectionShapeName; flatRectSection.shapeType = Structural.ShapeType.I; flatRectSection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("Height").GetValue(section); flatRectSection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("Width").GetValue(section); flatRectSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("SectionArea").GetValue(section); flatRectSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("NominalWeight").GetValue(section); flatRectSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); flatRectSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); flatRectSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = flatRectSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralS: // Round Bar structural sections var flatCircSection = new Circular(); flatCircSection.name = section.StructuralSectionShapeName; flatCircSection.shapeType = Structural.ShapeType.Circular; flatCircSection.radius = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("Diameter").GetValue(section) / 2; flatCircSection.wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("WallNominalThickness").GetValue(section); flatCircSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("SectionArea").GetValue(section); flatCircSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("NominalWeight").GetValue(section); flatCircSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); flatCircSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); flatCircSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = flatCircSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralW: // Angle structural sections var angleSection = new Angle(); angleSection.name = section.StructuralSectionShapeName; angleSection.shapeType = Structural.ShapeType.Angle; angleSection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("Height").GetValue(section); angleSection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("Width").GetValue(section); angleSection.webThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("WebThickness").GetValue(section); angleSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("FlangeThickness").GetValue(section); angleSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("SectionArea").GetValue(section); angleSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("NominalWeight").GetValue(section); angleSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); angleSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); angleSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = angleSection; break; case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralU: // Channel structural sections var channelSection = new Channel(); channelSection.name = section.StructuralSectionShapeName; channelSection.shapeType = Structural.ShapeType.Channel; channelSection.depth = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("Height").GetValue(section); channelSection.width = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("Width").GetValue(section); channelSection.webThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("WebThickness").GetValue(section); channelSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("FlangeThickness").GetValue(section); channelSection.area = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("SectionArea").GetValue(section); channelSection.weight = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("NominalWeight").GetValue(section); channelSection.Iyy = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("MomentOfInertiaStrongAxis").GetValue(section); channelSection.Izz = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("MomentOfInertiaWeakAxis").GetValue(section); channelSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("TorsionalMomentOfInertia").GetValue(section); speckleSection = channelSection; break; default: speckleSection.name = section.StructuralSectionShapeName; break; } var materialType = stickFamily.StructuralMaterialType; var structMat = (DB.Material)Doc.GetElement(stickFamily.StructuralMaterialId); if (structMat == null) { structMat = (DB.Material)Doc.GetElement(stickFamily.Symbol.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()); } var materialAsset = ((PropertySetElement)Doc.GetElement(structMat.StructuralAssetId)).GetStructuralAsset(); Structural.Materials.Material speckleMaterial = null; switch (materialType) { case StructuralMaterialType.Concrete: var concreteMaterial = new Concrete { name = Doc.GetElement(stickFamily.StructuralMaterialId).Name, //type = Structural.MaterialType.Concrete, grade = null, designCode = null, codeYear = null, elasticModulus = materialAsset.YoungModulus.X, compressiveStrength = materialAsset.ConcreteCompression, tensileStrength = 0, flexuralStrength = 0, maxCompressiveStrain = 0, maxTensileStrain = 0, maxAggregateSize = 0, lightweight = materialAsset.Lightweight, poissonsRatio = materialAsset.PoissonRatio.X, shearModulus = materialAsset.ShearModulus.X, density = materialAsset.Density, thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, dampingRatio = 0 }; speckleMaterial = concreteMaterial; break; case StructuralMaterialType.Steel: var steelMaterial = new Steel { name = Doc.GetElement(stickFamily.StructuralMaterialId).Name, //type = Structural.MaterialType.Steel, grade = materialAsset.Name, designCode = null, codeYear = null, elasticModulus = materialAsset.YoungModulus.X, // Newtons per foot meter yieldStrength = materialAsset.MinimumYieldStress, // Newtons per foot meter ultimateStrength = materialAsset.MinimumTensileStrength, // Newtons per foot meter maxStrain = 0, poissonsRatio = materialAsset.PoissonRatio.X, shearModulus = materialAsset.ShearModulus.X, // Newtons per foot meter density = materialAsset.Density, // kilograms per cubed feet thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin dampingRatio = 0 }; speckleMaterial = steelMaterial; break; case StructuralMaterialType.Wood: var timberMaterial = new Timber { name = Doc.GetElement(structMat.StructuralAssetId).Name, //type = Structural.MaterialType.Timber, grade = materialAsset.WoodGrade, designCode = null, codeYear = null, elasticModulus = materialAsset.YoungModulus.X, // Newtons per foot meter poissonsRatio = materialAsset.PoissonRatio.X, shearModulus = materialAsset.ShearModulus.X, // Newtons per foot meter density = materialAsset.Density, // kilograms per cubed feet thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin species = materialAsset.WoodSpecies, dampingRatio = 0 }; timberMaterial["bendingStrength"] = materialAsset.WoodBendingStrength; timberMaterial["parallelCompressionStrength"] = materialAsset.WoodParallelCompressionStrength; timberMaterial["parallelShearStrength"] = materialAsset.WoodParallelShearStrength; timberMaterial["perpendicularCompressionStrength"] = materialAsset.WoodPerpendicularCompressionStrength; timberMaterial["perpendicularShearStrength"] = materialAsset.WoodPerpendicularShearStrength; speckleMaterial = timberMaterial; break; default: var defaultMaterial = new Objects.Structural.Materials.Material { name = Doc.GetElement(stickFamily.StructuralMaterialId).Name }; speckleMaterial = defaultMaterial; break; } prop.profile = speckleSection; prop.material = speckleMaterial; prop.name = Doc.GetElement(revitStick.GetElementId()).Name; var structuralElement = Doc.GetElement(revitStick.GetElementId()); var mark = GetParamValue <string>(structuralElement, BuiltInParameter.ALL_MODEL_MARK); if (revitStick is AnalyticalModelColumn) { speckleElement1D.type = ElementType1D.Column; //prop.memberType = MemberType.Column; var locationMark = GetParamValue <string>(structuralElement, BuiltInParameter.COLUMN_LOCATION_MARK); if (locationMark == null) { speckleElement1D.name = mark; } else { speckleElement1D.name = locationMark; } } else { prop.memberType = MemberType.Beam; speckleElement1D.name = mark; } speckleElement1D.property = prop; GetAllRevitParamsAndIds(speckleElement1D, revitStick); speckleElement1D.displayMesh = GetElementDisplayMesh(Doc.GetElement(revitStick.GetElementId())); return(speckleElement1D); }