本文整理汇总了C#中ModelDoc2.ClearSelection2方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.ClearSelection2方法的具体用法?C# ModelDoc2.ClearSelection2怎么用?C# ModelDoc2.ClearSelection2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.ClearSelection2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: AutoDimensionDrawing2
//.........这里部分代码省略.........
element = _cxml.CreateElement("Sheet");
element.SetAttribute("Name", vSheetName);
_node = rootNode.AppendChild(element);
sheetNode = element;
}
double vScale = 0;
var type = new List<string>();
var listSize = new List<SizeForDim>();
swDrawing.ActivateSheet(vSheetName);
swModel.Extension.SelectByID2(vSheetName, "SHEET", 0, 0, 0, true,
(int)swSelectionMarkAction_e.swSelectionMarkAppend, null, 0);
swModel.ViewZoomToSelection();
swModel.ClearSelection();
var swSheet = (Sheet)swDrawing.GetCurrentSheet();
var swViews = (object[])swSheet.GetViews();
bool side = shi == 1;
if (isNeededSheetNumber && listSide.ContainsKey(vSheetName.Substring(vSheetName.Length - 1)))
side = listSide[vSheetName.Substring(vSheetName.Length - 1)];
if (vSheetName.ToUpper().Contains("FACE"))
side = true;
if (vSheetName.ToUpper().Contains("BACK"))
side = false;
if (swViews != null)
{
var rootViewElement = _node;
if (Properties.Settings.Default.ViewsBeforeDimen)
ReplaceViews(swViews, swDrawing);
foreach (var t in swViews)
{
#region Образмеривание вида
var swView = (View) t;
swModel.ClearSelection2(true);
const string expr = "^F[1-6]$";
Match isMatch = Regex.Match(swView.Name, expr, RegexOptions.IgnoreCase);
if (_createProgramm && swView.Name.ToLower().Contains("const"))
{
//Logging.Log.Instance.Fatal(@"На данный чертеж программа не будет создана! " + swModel.GetPathName() + "swView.Name = " + swView.Name);
//MessageBox.Show(@"На данный чертеж программа не будет создана!", @"MrDoors",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
}
if (!(isMatch.Success || swView.Name.Contains("Чертежный вид")) ||
swView.Name.ToLower().Contains("const") ||
swView.Type == (int)swDrawingViewTypes_e.swDrawingDetailView) continue;
if (_createProgramm && !isMatch.Success)
{
_createProgramm = false;
//Logging.Log.Instance.Fatal(@"На данный чертеж программа не будет создана! " + swModel.GetPathName() + "swView.Name = " + swView.Name);
//MessageBox.Show(@"На данный чертеж программа не будет создана!", @"MrDoors",
// MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
swDrawing.ActivateView(swView.GetName2());
swView.UseSheetScale = 0;
var list = HideUnusedComponents(swView, dimOnlyNew);
try
{
vScale = ((double[]) swView.ScaleRatio)[1];
示例3: GetCutComponents
private bool GetCutComponents(ModelDoc2 swModel,
out LinkedList<Component2> outCutComponents, out LinkedList<Component2> outShelfComponents, out bool delete)
{
delete = false;
var swComponents = new LinkedList<Component2>();
ModelDoc2 swCompModel;
outCutComponents = new LinkedList<Component2>();
outCutComponents.Clear();
outShelfComponents = new LinkedList<Component2>();
outShelfComponents.Clear();
var swConfig = (Configuration)swModel.GetActiveConfiguration();
if (swConfig != null)
{
var swRootComponent = (Component2)swConfig.GetRootComponent();
if (GetComponents(swRootComponent, swComponents, true, false))
{
foreach (Component2 comp in swComponents)
{
swCompModel = (ModelDoc2)comp.GetModelDoc();
if (swCompModel != null)
{
if (swCompModel.get_CustomInfo2("", "swrfIsCut") == "Yes")
{
outCutComponents.AddLast(comp);
}
if (swCompModel.get_CustomInfo2("", "swrfIsShelf") == "Yes")
{
if (swCompModel.GetType() == (int)swDocumentTypes_e.swDocASSEMBLY)
swCompModel.DeleteCustomInfo2("", "swrfIsShelf");
else
{
if (comp.GetTexture("") != null)
swCompModel.Save();
outShelfComponents.AddLast(comp);
}
#region �������� ������ �������� ���������
var swFeat = comp.FirstFeature();
while (swFeat != null)
{
if (swFeat.GetTypeName2() == "Cavity")
{
if (swFeat.Name.Contains("#swrf"))
{
swFeat.Select(true);
delete = true;
}
}
swFeat = swFeat.IGetNextFeature();
}
if (delete)
{
swModel.DeleteSelection(true);
swModel.ClearSelection2(true);
GC.Collect();
}
#endregion
}
}
}
}
}
return true;
}
示例4: saveSWComponents
//Converts the SW component references to PIDs
public static void saveSWComponents(ModelDoc2 model, link Link)
{
model.ClearSelection2(true);
byte[] PID = saveSWComponent(model, Link.SWMainComponent);
if (PID != null)
{
Link.SWMainComponentPID = PID;
}
Link.SWComponentPIDs = saveSWComponents(model, Link.SWcomponents);
foreach (link Child in Link.Children)
{
saveSWComponents(model, Child);
}
}