//使能面板上的位置显示控件,并显示位置 private void ShowLocation(double Xposition, double Yposition) { m_connectCmdDlg.numerUPX.Enabled = true; m_connectCmdDlg.numerUPY.Enabled = true; UnitsOfMeasure unitsOfMeasure = m_inventorApplication.ActiveDocument.UnitsOfMeasure; string unitExpre = unitsOfMeasure.GetStringFromType(unitsOfMeasure.LengthUnits); m_connectCmdDlg.numerUPX.Text = (unitsOfMeasure.ConvertUnits(Xposition, "cm", unitExpre)).ToString(); m_connectCmdDlg.numerUPY.Text = (unitsOfMeasure.ConvertUnits(Yposition, "cm", unitExpre)).ToString(); }
private void ShowDia(double dia) { //get the active document Document activeDocument = m_inventorApplication.ActiveDocument; //get the unit of measure object UnitsOfMeasure unitsOfMeasure = activeDocument.UnitsOfMeasure; string unitExpre = unitsOfMeasure.GetStringFromType(unitsOfMeasure.LengthUnits); m_connectCmdDlg.diaTextBox.Text = (unitsOfMeasure.ConvertUnits(dia, "cm", unitExpre)).ToString(); }
public void UpdateCommandStatus() { m_connectCmdDlg.connectOkButton.Enabled = false; //更新连接对齐类型 if (m_connectCmdDlg.centerRadioButton.Checked == false && m_connectCmdDlg.onesideRadioButton.Checked == false && m_connectCmdDlg.othersideRadioButton.Checked == false) { m_connectAlignType = ConnectAlignTypeEnum.kNoneType; } else { if (m_connectCmdDlg.centerRadioButton.Checked == true) { m_connectAlignType = ConnectAlignTypeEnum.kCenterAlignType; } else { if (m_connectCmdDlg.onesideRadioButton.Checked == true) { m_connectAlignType = ConnectAlignTypeEnum.kOnesideAlignType; } else { m_connectAlignType = ConnectAlignTypeEnum.kOthersideAlignType; } } } //更新元件1的UCS使其显示,并将其选中port加入高亮显示集 if (m_thisSurface != null) { if (m_highlightSet != null) { this.ClearHighlight(); } this.HightghtSelectSurface(m_thisSurface); //若两元件均已选择完毕,则判断两元件是否平行 if (m_connectToSurface != null) { m_connectCmdDlg.connectOkButton.Enabled = true; if (IsCavParallel()) { MessageBox.Show("无法连接平行油孔!请选择其他油孔。"); m_connectToSurface = null; m_connectToCav = null; if (m_highlightSet != null) { this.ClearHighlight(); } m_connectCmdDlg.connectOkButton.Enabled = false; return; } this.HightghtSelectSurface(m_connectToSurface); UpdatePreviewGraphics(); } else { m_connectCmdDlg.connectOkButton.Enabled = false; } } //更新元件1相对位置 UnitsOfMeasure unitsOfMeasure = m_inventorApplication.ActiveDocument.UnitsOfMeasure; string unitExpre = unitsOfMeasure.GetStringFromType(unitsOfMeasure.LengthUnits); m_Xposition = unitsOfMeasure.ConvertUnits(double.Parse(m_connectCmdDlg.numerUPX.Text), unitExpre, "cm"); m_Yposition = unitsOfMeasure.ConvertUnits(double.Parse(m_connectCmdDlg.numerUPY.Text), unitExpre, "cm"); //更新元件2 portIndex if (m_connectCmdDlg.portIndexComboBox.Text != "") { m_portIndex = int.Parse(m_connectCmdDlg.portIndexComboBox.Text); } //更新元件1 port1的Dia if (m_connectCmdDlg.diaTextBox.Text != "") { m_Dia = unitsOfMeasure.ConvertUnits(double.Parse(m_connectCmdDlg.diaTextBox.Text), unitExpre, "cm"); } }