本文整理汇总了C#中ModelDoc2.EditRebuild3方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.EditRebuild3方法的具体用法?C# ModelDoc2.EditRebuild3怎么用?C# ModelDoc2.EditRebuild3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.EditRebuild3方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例2: AutoDimensionDrawing2
//.........这里部分代码省略.........
element.SetAttribute("X", Math.Round(d.X).ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
element.SetAttribute("Y", Math.Round(d.Y).ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
if (swView.Name == "F1" || swView.Name == "F6")
element.SetAttribute("Z", _z.ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
if (_node != null)
_node.AppendChild(element);
foreach (var ls in d.ListSize)
{
i++;
id = "id" + i;
element = _cxml.CreateElement(id);
element.SetAttribute("X", ls.X.ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
element.SetAttribute("Y", ls.Y.ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
element.SetAttribute("Diameter", ls.Diameter.ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
element.SetAttribute("Depth",ls.Depth.ToString(CultureInfo.CreateSpecificCulture("ru-RU")));
if (_node != null)
_node.AppendChild(element);
}
_node = _node.ParentNode;
}
#endregion
}
#endregion
swView.SetDisplayMode3(false, (int) swDisplayMode_e.swFACETED_HIDDEN_GREYED, true, true);
swDrawing.ActivateSheet(vSheetName);
}
catch (Exception e)
{
MessageBox.Show(@"Ошибка при образмеривании! " + e.Message, @"MrDoors",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
if (dimOnlyNew)
ShowHiddenComponents(list);
}
#endregion
}
}
if (type.Count != 0)
LegendMaker(swModel, swDrawing, type, vScale);
if (!string.IsNullOrEmpty(tableNameAttribute.Value))
sheetNode.SetAttribute("TableName", tableNameAttribute.Value);
if (Properties.Settings.Default.ScaleWhenDimen && !del3List && shi != 0)
AutoScaleSheet(listSize, swSheet, vScale, side);
shi++;
if(_node!=null)
_node = _node.ParentNode;
AutoArrangeDimentions(vSheetName,dimOnlyNew);
}
swModel.EditRebuild3();
if (shi == 3)
{
if (del3List)
{
if (isNeededSheetNumber && thrdList.Count > 0)
foreach (var sh in thrdList)
swModel.Extension.SelectByID2(sh, "SHEET", 0, 0, 0, true, 0, null, 0);
else
{
if (!swModel.Extension.SelectByID2("Лист3", "SHEET", 0, 0, 0, false, 0, null, 0))
{
swModel.Extension.SelectByID2("Back3", "SHEET", 0, 0, 0, false, 0, null, 0);
}
}
swModel.DeleteSelection(true);
}
else
SheetNumering(swModel, swDrawing);
}
swModel.ForceRebuild3(false);
bool writeXml = true;
if (atLeastOneF1View)
{
try
{
writeXml=SomeLogicChanges(swModel);
}
catch(Exception e)
{
if (swModel.GetPathName() != null)
Logging.Log.Instance.Fatal(e, "Ошибка при применении логики к XML. " + swModel.GetPathName());
else
Logging.Log.Instance.Fatal(e, "Ошибка при применении логики к XML. ");
}
if (writeXml)
StopWriteXml(pathXml);
}
return;
}
示例3: RecopyHeare
//.........这里部分代码省略.........
}
}
if (newRef != null)
{
swDoc.ReplaceReference(o, newRef);
swDoc.Save();
}
}
}
}
else
{
swDoc.CloseDoc();
continue;
}
swDoc.CloseDoc();
}
}
swApp.CloseAllDocuments(true);
if (!File.Exists(_openFile))
throw new Exception("Ошибка. Не найден файл: " + _openFile);
foreach (var file in newFileNames)
{
File.SetAttributes(file,FileAttributes.Normal);
}
//Logging.Log.Instance.Debug("SetAttributes ");
SwAddin.IsEventsEnabled = true;
swModelDoc = (ModelDoc2)swApp.OpenDoc6(_openFile, (int)swDocumentTypes_e.swDocASSEMBLY,
(int)swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors,
warnings);
SwAddin.IsEventsEnabled = false;
//Logging.Log.Instance.Debug("OpenDoc6");
swModelDoc.EditRebuild3();
swAddin.AttachModelDocEventHandler(swModelDoc);
//теперь тут пробежатся по всем файлам в filesToHideAndShow. key -хайдить , value - показывать
//foreach (var files in filesToHideAndShow)
//{
// if (File.Exists(files.Key) && File.Exists(files.Value))
// {
// File.SetAttributes(files.Value, FileAttributes.Normal);
// File.SetAttributes(files.Key, FileAttributes.Hidden);
// string nextFile,sourceFile = files.Key;
// while (SwAddin.IfNextExist(sourceFile, out nextFile))
// {
// sourceFile = nextFile;
// File.SetAttributes(nextFile, FileAttributes.Hidden);
// }
// }
//}
SwDmCustomInfoType swDmCstInfoType;
if (Directory.Exists(furnDir))
{
foreach (string path in Directory.GetFiles(furnDir, "*.sldasm", SearchOption.TopDirectoryOnly))
{
if (!File.Exists(path))
continue;
var swDoc = swDocMgr.GetDocument(path, SwDmDocumentType.swDmDocumentAssembly, true, out oe);
if (Path.GetFileNameWithoutExtension(path).First() == '~' || swDoc == null)
continue;
string valueOfName = swDoc.GetCustomProperty("Accessories", out swDmCstInfoType);
swDoc.CloseDoc();
if (valueOfName != null && (valueOfName == "No" || valueOfName == "no"))
{
File.Delete(path);
}