| | |
| | | using System.IO;
|
| | | using System.Linq;
|
| | | using System.Windows.Forms;
|
| | | using Autodesk.Revit.UI;
|
| | |
|
| | | namespace HStation.RevitDev.RevitDataExport.Utility
|
| | | {
|
| | |
| | | {
|
| | | return;
|
| | | }
|
| | | GlobalResource.HideMode = !GlobalResource.HideMode;
|
| | | using (Transaction trans = new Transaction(document, "hide elements"))
|
| | | try
|
| | | {
|
| | | trans.Start();
|
| | | if (GlobalResource.HideMode)
|
| | | GlobalResource.HideMode = !GlobalResource.HideMode;
|
| | | using (Transaction trans = new Transaction(document, "hide elements"))
|
| | | {
|
| | | document.ActiveView.HideElements(ids);
|
| | | trans.Start();
|
| | | if (GlobalResource.HideMode)
|
| | | {
|
| | | document.ActiveView.HideElements(ids);
|
| | | }
|
| | | else
|
| | | {
|
| | | document.ActiveView.UnhideElements(ids);
|
| | | }
|
| | | trans.Commit();
|
| | | }
|
| | | else
|
| | | }
|
| | | catch (Exception ex) |
| | | { |
| | | TaskDialog.Show("错误", "显隐失败,可能存在不能设置隐藏的构件!"); |
| | | }
|
| | | }
|
| | |
|
| | | public static void HideOrShowOtherModels(Document document)
|
| | | {
|
| | | if (document == null) { return; }
|
| | |
|
| | | var ids = GlobalResource.RevitModels.GetOtherIds()?.Select(x => new ElementId(int.Parse(x))).ToList();
|
| | | if (ids.Count == 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | | try
|
| | | {
|
| | | GlobalResource.IsOtherHidden = !GlobalResource.IsOtherHidden;
|
| | | using (Transaction trans = new Transaction(document, "hide other elements"))
|
| | | {
|
| | | document.ActiveView.UnhideElements(ids);
|
| | | trans.Start();
|
| | | if (GlobalResource.IsOtherHidden)
|
| | | {
|
| | | document.ActiveView.HideElements(ids);
|
| | | }
|
| | | else
|
| | | {
|
| | | document.ActiveView.UnhideElements(ids);
|
| | | }
|
| | | trans.Commit();
|
| | | }
|
| | | trans.Commit();
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | TaskDialog.Show("错误", "显隐失败,可能存在不能设置隐藏的构件!");
|
| | | }
|
| | | }
|
| | | }
|