本文整理汇总了C#中ModelDoc2类的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2类的具体用法?C# ModelDoc2怎么用?C# ModelDoc2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelDoc2类属于命名空间,在下文中一共展示了ModelDoc2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddModelToList
internal static void AddModelToList(SwAddin mSwAddin, ModelDoc2 newModel)
{
List<ModelDoc2> fM = null;
string xNameOfAss = mSwAddin.GetXNameForAssembly(false, Path.GetFileNameWithoutExtension(mSwAddin.SwModel.GetPathName()));
#region Проверка на наличие модели,которая была удалена
var checkList = new List<ModelDoc2>();
if (!DictionaryListMdb.ContainsKey(xNameOfAss))
DictionaryListMdb.Add(xNameOfAss, new List<ModelDoc2>());
foreach (var m in DictionaryListMdb[xNameOfAss])
{
try
{
m.GetPathName();
checkList.Add(m);
}
catch (COMException)
{
continue;
}
}
#endregion
if (!checkList.Contains(newModel))
CheckMdbForDecors(mSwAddin, newModel, checkList, null, fM);
DictionaryListMdb[xNameOfAss] = checkList;
}
示例2: JointAxis
public JointAxis(SldWorks swApp, AssemblyDoc asm, StorageModel swData, string path, Joint current, int index, RobotModel robot)
{
this.swApp = swApp;
this.asmDoc = asm;
this.modelDoc = (ModelDoc2)asm;
this.swData = swData;
this.path = path;
this.owner = current;
this.robot = robot;
this.AxisIndex = index;
if (EffortLimit == 0)
{
this.EffortLimit = 1;
}
if (this.VelocityLimit == 0)
{
this.VelocityLimit = 1;
}
if (Axis != null)
{
CalcAxisVectors();
//CalcLimits(null);
}
if (index == 2)
{
IsContinuous = true;
}
}
示例3: DocumentEventHandler
public DocumentEventHandler(ModelDoc2 modDoc, SwAddin addin)
{
document = modDoc;
userAddin = addin;
iSwApp = (ISldWorks)userAddin.SwApp;
openModelViews = new Hashtable();
}
示例4: frmFullPrice
public frmFullPrice(ModelDoc2 model)
{
InitializeComponent();
CurrentState = State.ErrorsHide;
this.model = model;
}
示例5: 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;
}
示例6: AssemblyEventHandler
public AssemblyEventHandler(ModelDoc2 modDoc, SwAddin addin)
: base(modDoc, addin)
{
doc = (AssemblyDoc)document;
swModel = modDoc;
swAddin = addin;
}
示例7: DocumentEventHandler
public DocumentEventHandler(ModelDoc2 modDoc, SwAddin addin)
{
Document = modDoc;
UserAddin = addin;
SwApp = UserAddin.SwApp;
OpenModelViews = new Hashtable();
}
示例8: frmCopyProject
public frmCopyProject(SwAddin swAdd,ISldWorks iswApp,ModelDoc2 rootModel,string openFile)
{
_swAdd = swAdd;
_iswApp = iswApp;
_swModelDoc = rootModel;
_openFile = openFile;
InitializeComponent();
WarningLabel.Text = string.Empty;
}
示例9: KitchenModule
public KitchenModule(ModelDoc2 _rootModel, Component2 _swRootComponent, SwAddin _swAddin, ModelDoc2 _swModel)
{
RootModel = _rootModel;
swRootComponent = _swRootComponent;
measure = RootModel.Extension.CreateMeasure();
swAddin = _swAddin;
swModel = _swModel;
rootName = Path.GetFileNameWithoutExtension(RootModel.GetPathName());
}
示例10: FrmReplaceComponents
public FrmReplaceComponents(SwAddin swAddin, Component2[] selComps)
{
InitializeComponent();
_mSwAddin = swAddin;
_mSelComps = selComps;
_swModel = (ModelDoc2)_mSwAddin.SwApp.ActiveDoc;
Show();
}
示例11: showAllComponents
//Except for an exclusionary list, this shows all the components
public static void showAllComponents(ModelDoc2 model, List<string> hiddenComponents)
{
AssemblyDoc assyDoc = (AssemblyDoc)model;
List<Component2> componentsToShow = new List<Component2>();
object[] varComps = assyDoc.GetComponents(false);
foreach (Component2 comp in varComps)
{
if (!hiddenComponents.Contains(comp.Name2))
{
componentsToShow.Add(comp);
}
}
showComponents(model, componentsToShow);
}
示例12: selectComponents
//Selects components from a list.
public static void selectComponents(ModelDoc2 model, List<Component2> components, bool clearSelection = true, int mark = -1)
{
if (clearSelection)
{
model.ClearSelection2(true);
}
SelectionMgr manager = model.SelectionManager;
SelectData data = manager.CreateSelectData();
data.Mark = mark;
foreach (Component2 component in components)
{
component.Select4(true, data, false);
}
}
示例13: getSelectedComponents
//Finds the selected components and returns them, used when pulling the items from the selection box because it would be too hard
// for SolidWorks to allow you to access the selectionbox components directly.
public static void getSelectedComponents(ModelDoc2 model, List<Component2> Components, int Mark = -1)
{
SelectionMgr selectionManager = model.SelectionManager;
Components.Clear();
for (int i = 0; i < selectionManager.GetSelectedObjectCount2(Mark); i++)
{
object obj = selectionManager.GetSelectedObject6(i + 1, Mark);
Component2 comp = (Component2)obj;
if (comp != null)
{
Components.Add(comp);
}
}
}
示例14: Actualization
public static void Actualization(ModelDoc2 model, SwAddin _mSwAddin)
{
Component2 _swSelectedComponent = model.ConfigurationManager.ActiveConfiguration.GetRootComponent3(true);
OleDbCommand cm;
OleDbDataReader rd;
OleDbConnection oleDb;
if (!_mSwAddin.OpenModelDatabase(model, out oleDb))
return;
cm = new OleDbCommand("SELECT * FROM faners ORDER BY FanerName ", oleDb);
rd = cm.ExecuteReader();
List<Faner> faners = new List<Faner>();
while (rd.Read())
{
if (rd["FanerType"] as string != null)
{
faners.Add(new Faner((string)rd["FanerName"], (string)rd["FanerType"], (string)rd["DecorGroup"]));
}
else
{
faners.Add(new Faner((string)rd["FanerName"], string.Empty, (string)rd["DecorGroup"]));
}
}
rd.Close();
Feature feature;
foreach (var faner in faners)
{
string suffix = faner.FanerName.Substring(faner.FanerName.Length - 2, 2);
feature = FindEdge(_swSelectedComponent, faner.AxFanerName);
if (feature != null)
{
if (feature.IsSuppressed())
{
_mSwAddin.SetModelProperty(model, "Faner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
_mSwAddin.SetModelProperty(model, "colorFaner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
}
else
{
string fieldValue = model.GetCustomInfoValue(string.Empty, "Faner" + suffix);
if (fieldValue == string.Empty)
{
string msgText = "Для данной детали: " + model.GetPathName() + " кромка Faner" + suffix + " в модели не соответствует свойствам файла сборки. Данная кромка не будет импортирована в программу Покупки! Чтобы исправить эту ошибку используйте опцию \"MrDoors - Отделка кромки\"";
MessageBox.Show(msgText, @"MrDoors", MessageBoxButtons.OK);
}
}
}
}
}
示例15: FrmEdge
public FrmEdge(SwAddin swAddin)
{
InitializeComponent();
_mSwAddin = swAddin;
_swModel = (ModelDoc2)_mSwAddin.SwApp.ActiveDoc;
_swSelMgr = (SelectionMgr)_swModel.SelectionManager;
_swAsmDoc = (AssemblyDoc)_swModel;
_swAsmDoc.NewSelectionNotify += NewSelection;
pbEdge11.Image = null;
pbEdge12.Image = null;
pbEdge21.Image = null;
pbEdge22.Image = null;
NewSelection();
Show();
}