public EditLimits(SkeletalJoint_Base joint) { InitializeComponent(); IEnumerator <AngularDOF> angularDOF = joint.GetAngularDOF().GetEnumerator(); { int i = 0; bool hasAnother = angularDOF.MoveNext(); while (hasAnother) { tabDOF.TabPages.Add(new LimitPane <AngularDOF>( angularDOF.Current, "Angular" + ((hasAnother = angularDOF.MoveNext()) ? " #" + (++i) : ""))); } } IEnumerator <LinearDOF> linearDOF = joint.GetLinearDOF().GetEnumerator(); { int i = 0; bool hasAnother = linearDOF.MoveNext(); while (hasAnother) { tabDOF.TabPages.Add(new LimitPane <LinearDOF>( linearDOF.Current, "Linear" + ((hasAnother = linearDOF.MoveNext()) ? " #" + (++i) : ""))); } } base.Text = joint.GetType().Name.Replace("_Base", "").Replace("Joint", " Joint"); FormClosing += delegate(object sender, FormClosingEventArgs e) { LegacyInterchange.LegacyEvents.OnRobotModified(); }; }
public EditLimits(SkeletalJoint_Base joint) { InitializeComponent(); IEnumerator <AngularDOF> angularDOF = joint.GetAngularDOF().GetEnumerator(); { int i = 0; bool hasAnother = angularDOF.MoveNext(); while (hasAnother) { tabDOF.TabPages.Add(new LimitPane <AngularDOF>( angularDOF.Current, "Angular" + ((hasAnother = angularDOF.MoveNext()) ? " #" + (++i) : ""))); } } IEnumerator <LinearDOF> linearDOF = joint.GetLinearDOF().GetEnumerator(); { int i = 0; bool hasAnother = linearDOF.MoveNext(); while (hasAnother) { tabDOF.TabPages.Add(new LimitPane <LinearDOF>( linearDOF.Current, "Linear" + ((hasAnother = linearDOF.MoveNext()) ? " #" + (++i) : ""))); } } base.Text = joint.GetType().Name.Replace("_Base", "").Replace("Joint", " Joint"); }
public EditLimits(SkeletalJoint_Base joint) { this.joint = joint; // read in the joint base so we can access the correspodinig Inventor Joint to see/ edit the limits InitializeComponent(); if (!(((InventorSkeletalJoint)joint).GetWrapped().asmJoint.JointType == AssemblyJointTypeEnum.kCylindricalJointType || // if the joint is a rotational then enable the rotation stuff and disable the linear ((InventorSkeletalJoint)joint).GetWrapped().asmJoint.JointType == AssemblyJointTypeEnum.kSlideJointType)) { this.LinearGroup.Enabled = false; this.Angular_Current_textbox.Value = (decimal)(((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.AngularPosition).ModelValue * (180 / Math.PI));// convert from RAD to DEG this.Angular_Start.Checked = false; this.Angular_End.Checked = false; this.Angular_Start_textbox.Enabled = false; this.Angular_End_textbox.Enabled = false; if (((InventorSkeletalJoint)joint).GetWrapped().asmJoint.HasAngularPositionLimits)// check if the joint has limits so we know whether or not to read in the joint data from Inventor and whether or not to activate the angular limits form { this.Angular_Start.Checked = true; this.Angular_End.Checked = true; this.Angular_Start_textbox.Enabled = true; this.Angular_End_textbox.Enabled = true; this.Angular_Start_textbox.Value = (decimal)((((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.AngularPositionStartLimit).ModelValue * (180 / Math.PI))); this.Angular_End_textbox.Value = (decimal)((((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.AngularPositionEndLimit).ModelValue * (180 / Math.PI))); } } else// if the joint is a linear joint then activate the linear stuff and deactivate the rotational stuff { this.Angular_Group_Box.Enabled = false; this.Linear_Current_textbox.Value = (decimal)(((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.LinearPosition).ModelValue / 2.54);// convert from CM to IN this.Linear_Start.Checked = false; this.Linear_End.Checked = false; this.Linear_Start_textbox.Enabled = false; this.Linear_End_textbox.Enabled = false; if (((InventorSkeletalJoint)joint).GetWrapped().asmJoint.HasLinearPositionStartLimit)// if the joint has a start limit then read it in and activate the corresponding fields { this.Linear_Start_textbox.Value = (decimal)((((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.LinearPositionStartLimit).ModelValue) / 2.54); this.Linear_Start_textbox.Enabled = true; this.Linear_Start.Checked = true; } if (((InventorSkeletalJoint)joint).GetWrapped().asmJoint.HasLinearPositionEndLimit)// if the joint has an end limit then read it in and activate the corresponding fields { this.Linear_End_textbox.Value = (decimal)((((ModelParameter)((InventorSkeletalJoint)joint).GetWrapped().asmJoint.LinearPositionEndLimit).ModelValue) / 2.54); this.Linear_End_textbox.Enabled = true; this.Linear_End.Checked = true; } } base.Text = joint.GetType().Name.Replace("_Base", "").Replace("Joint", " Joint"); base.Location = new System.Drawing.Point(Cursor.Position.X - 10, Cursor.Position.Y - base.Height - 10); }