本文整理汇总了C#中ModelDoc2.GetConfigurationNames方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.GetConfigurationNames方法的具体用法?C# ModelDoc2.GetConfigurationNames怎么用?C# ModelDoc2.GetConfigurationNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.GetConfigurationNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setRobot
/// <summary>
/// Sets the current robot that is linked to this page
/// </summary>
/// <param name="robot">robot to be used</param>
/// <param name="model">model to be used</param>
public void setRobot(RobotModel robot, ModelDoc2 model)
{
this.robot = robot;
robotName.Text = robot.Name;
string[] configurations = model.GetConfigurationNames();
IncludeFRCfieldBox.Visible = PluginSettings.UseFRCsim;
if (PluginSettings.UseFRCsim)
{
switch (robot.FRCfield)
{
case 2014:
FRC2014FieldButton.Checked = true;
break;
case 2015:
FRC2015FieldButton.Checked = true;
break;
default:
NoFieldButton.Checked = true;
break;
}
}
if (robot.ExportType == 0)
SDFExportTypeButton.Checked = true;
else
URDFExportTypeButton.Checked = true;
}
示例2: ReloadAllSetParameters
//.........这里部分代码省略.........
btnRef.Click += ExpandBtn;
if (!_butPlusTxt.ContainsKey(btnRef))
_butPlusTxt.Add(btnRef, txtNew);
}
#endregion
}
tbpParams.Controls.Add(txtNew);
_commonList.Add(txtNew);
#endregion
}
#endregion
}
else
{
#region ComboBox с конфигурациями
var cmp = dimensionConfForList.Component;
var comboBoxConfForDimTab = new ComboBox
{
Size = new Size(56, 24),
Location =
new Point(
lblNew.Location.X +
lblNew.Size.Width + 4,
lblNew.Location.Y),
Tag = cmp,
TabIndex = i
};
var confNames =
(string[])cmp.IGetModelDoc().GetConfigurationNames();
foreach (var confName in confNames)
{
int lonhName = confName.Length * 6;
if (comboBoxConfForDimTab.DropDownWidth < lonhName)
comboBoxConfForDimTab.DropDownWidth = lonhName;
comboBoxConfForDimTab.Items.Add(confName);
}
comboBoxConfForDimTab.SelectedItem = cmp.ReferencedConfiguration;
tbpParams.Controls.Add(comboBoxConfForDimTab);
_comboBoxListForRedraw.Add(comboBoxConfForDimTab,
dimensionConfForList.IdSlave);
comboBoxConfForDimTab.SelectedIndexChanged +=
ComboBoxConfForDimTabSelectedIndexChanged;
#endregion
}
i++;
}
#region Добавить выбор конфигурации
try
{
if (_swSelModel.GetConfigurationCount() > 1)
{
var lblNew = new Label { Size = new Size(125, 24) };
lblNew.Location = new Point(0, 48 + i * (lblNew.Size.Height + 6));
lblNew.Name = "lblPrm" + i;
lblNew.TextAlign = ContentAlignment.MiddleRight;
lblNew.Text = "Конфигурации:";
tbpParams.Controls.Add(lblNew);
示例3: 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
}
示例4: SetObjectValue
public bool SetObjectValue(ModelDoc2 inModel, string inName, int inType, double inVal, bool noArtIfSuppressed = false)
{
object swObj;
Dimension swDim;
Feature swFeature;
Component2 swComp;
bool ret = false;
if (GetObjectByName(inModel, inName, inType, out swObj))
{
double dTestVal;
switch (inType)
{
case 14:
swDim = (Dimension)swObj;
dTestVal = swDim.GetSystemValue2("") * 1000;
if (dTestVal != inVal)
{
ret = (swDim.SetSystemValue2(inVal / 1000,
(int)
swSetValueInConfiguration_e.swSetValue_InAllConfigurations) ==
(int)swSetValueReturnStatus_e.swSetValue_Successful);
}
else
ret = true;
break;
case 22:
swFeature = (Feature)swObj;
dTestVal = (swFeature.IsSuppressed() ? 0 : 1);
if (dTestVal != inVal)
{
//ret = swFeature.SetSuppression(inVal == 0 ? (int) swFeatureSuppressionAction_e.swSuppressFeature : (int)swFeatureSuppressionAction_e.swUnSuppressFeature);
ret =
swFeature.SetSuppression2(
inVal == 0
? (int)swFeatureSuppressionAction_e.swSuppressFeature
: (int)swFeatureSuppressionAction_e.swUnSuppressFeature,
(int)swInConfigurationOpts_e.swAllConfiguration, inModel.GetConfigurationNames());
#region ������ ��������
Component2 newComp = null;
var config = inModel.IGetActiveConfiguration();
if (config != null)
{
swComp = config.IGetRootComponent2();
if (swComp != null)
{
var outComps = new LinkedList<Component2>();
if (GetComponents(swComp, outComps, false, false))
{
foreach (var component2 in outComps)
{
var mod = component2.IGetModelDoc();
if (mod != null)
{
var texture = component2.GetTexture("");
if (mod.GetType() == (int)swDocumentTypes_e.swDocPART &&
texture != null)
{
newComp = component2;
}
}
}
}
}
}
if (newComp != null)
{
inModel.Save();
if (newComp.Select(false))
((AssemblyDoc)inModel).ComponentReload();
}
#endregion
}
else
ret = true;
break;
case 20:
swComp = (Component2)swObj;
try
{
if ((swComp.IsSuppressed() ? 0 : 1) == inVal)
{
ret = true;
}
else
{
int k = inVal == 0
? (int)swComponentSuppressionState_e.swComponentSuppressed
: (int)swComponentSuppressionState_e.swComponentFullyResolved;
bool isCavity = false;
if (inVal == 0)
//.........这里部分代码省略.........