本文整理汇总了C#中ModelDoc2.GetConfigurationByName方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.GetConfigurationByName方法的具体用法?C# ModelDoc2.GetConfigurationByName怎么用?C# ModelDoc2.GetConfigurationByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.GetConfigurationByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenDoc
public void OpenDoc(int idPdm, int revision, int taskType, string filePath, string fileName)
{
swApp = new SldWorks() {Visible = true};
Process[] processes = Process.GetProcessesByName("SLDWORKS");
var errors = 0;
var warnings = 0;
#region Case
switch (taskType)
{
case 1:
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectionColor = Color.Black));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += (String.Format("Выполняется: {0}\r\n", filePath))));
swModel = swApp.OpenDoc6(filePath, (int) swDocumentTypes_e.swDocPART, (int) swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings);
swModel = swApp.ActiveDoc;
if (!IsSheetMetalPart((IPartDoc) swModel))
{
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectionColor = Color.DarkBlue));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += ("Не листовой металл!\r\n")));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += ("--------------------------------------------------------------------------------------------------------------\r\n")));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += ("\r\n")));
swApp.CloseDoc(filePath);
swApp.ExitApp();
swApp = null;
foreach (Process process in processes)
{
process.CloseMainWindow();
process.Kill();
}
return;
}
swExtension = (ModelDocExtension) swModel.Extension;
swModel.EditRebuild3();
swModel.ForceRebuild3(false);
CreateFlattPatternUpdate();
object[] confArray = swModel.GetConfigurationNames();
foreach (var confName in confArray)
{
Configuration swConf = swModel.GetConfigurationByName(confName.ToString());
if (swConf.IsDerived()) continue;
Area(confName.ToString());
GabaritsForPaintingCamera(confName.ToString());
}
ExportDataToXmlSql(fileName, idPdm, revision);
ConvertToErpt(filePath);
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectionColor = Color.Black));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += (String.Format("{0} - Выполнен!\r\n", filePath))));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += ("-----------------------------------------------------------------\r\n")));
Program.HostForm.richTextBoxLog.Invoke(new Action(() => Program.HostForm.richTextBoxLog.SelectedText += ("\r\n")));
break;
case 2:
swModel = swApp.OpenDoc6(filePath, (int) swDocumentTypes_e.swDocDRAWING, (int) swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings);
//if (warnings == (int)swFileLoadWarning_e.swFileLoadWarning_ReadOnly)
//{MessageBox.Show("This file is read-only.");}
swDraw = (DrawingDoc) swModel;
swExtension = (ModelDocExtension) swModel.Extension;
ConvertToPdf(filePath);
break;
case 3:
//swModel = swApp.OpenDoc6(filePath, (int)swDocumentTypes_e.swDocPART, (int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", ref errors, ref warnings);
MessageBox.Show("3");
break;
}
//TODO: swApp exit
swApp.CloseDoc(filePath);
swApp.ExitApp();
swApp = null;
foreach (Process process in processes)
{
process.CloseMainWindow();
process.Kill();
}
#endregion
}