private void btnWriteObjectInfo_Click(object sender, EventArgs e) { if (!AppManager.ApplicationsStarted) { MessageBox.Show("External applications is not started"); return; } Excel excel = AppManager.ExcelApp; AutoCAD autoCAD = AppManager.AutoCADApp; var objectsProperties = autoCAD.SelectedObjectsProperties(); int row = 1; bool alternativeColor = false; foreach (var objectProperties in objectsProperties) { foreach (var objectProperty in objectProperties) { string propertyCellAddress = $"{txtObjectInfoSheet.Text}!C{row}"; string valueCellAddress = $"{txtObjectInfoSheet.Text}!D{row}"; excel.SetRangeValue(propertyCellAddress, objectProperty.Key); excel.SetRangeValue(valueCellAddress, objectProperty.Value); if (alternativeColor) { excel.SetRangeForeground(propertyCellAddress, 8388608); excel.SetRangeForeground(valueCellAddress, 8388608); } row++; } alternativeColor = !alternativeColor; } }
private void btnDrawCircle_Click(object sender, EventArgs e) { if (!AppManager.ApplicationsStarted) { MessageBox.Show("External applications is not started"); return; } Excel excel = AppManager.ExcelApp; AutoCAD autoCAD = AppManager.AutoCADApp; object cx = excel.GetRangeValue(txtCenterXCell.Text); object cy = excel.GetRangeValue(txtCenterYCell.Text); object r = excel.GetRangeValue(txtRadiusCell.Text); autoCAD.DrawCircle(Convert.ToDouble(cx), Convert.ToDouble(cy), Convert.ToDouble(r)); }