增加保温层和整理管线的功能,修复自动保存功能等修复多个bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using System.Windows;
|
||||
|
||||
using Autodesk.Revit.UI;
|
||||
@@ -21,23 +21,31 @@ public class RvApp : ExternalApplication
|
||||
{
|
||||
private static readonly string TabName = Settings.Default.TabName;
|
||||
private AsyncEventHandler saveHandler;
|
||||
|
||||
readonly System.Timers.Timer saveTimer = Variables.AutoSaveTimer;
|
||||
private void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
saveHandler.RaiseAsync(app =>
|
||||
{
|
||||
{
|
||||
|
||||
#if REVIT2018
|
||||
if (app.ActiveUIDocument.Document.IsModified)
|
||||
{
|
||||
app.ActiveUIDocument.Document.Save();
|
||||
}
|
||||
foreach (Autodesk.Revit.DB.Document doc in app.Application.Documents)
|
||||
{
|
||||
if (doc.IsModified && !string.IsNullOrEmpty(doc.PathName))
|
||||
{
|
||||
doc.Save();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
if (!app.ActiveUIDocument.Document.IsBackgroundCalculationInProgress() && app.ActiveUIDocument.Document.IsModified)
|
||||
{
|
||||
app.ActiveUIDocument.Document.Save();
|
||||
}
|
||||
foreach (Autodesk.Revit.DB.Document doc in app.Application.Documents)
|
||||
{
|
||||
if (!doc.IsBackgroundCalculationInProgress() && doc.IsModified&&!string.IsNullOrEmpty(doc.PathName))
|
||||
{
|
||||
doc.Save();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
});
|
||||
});
|
||||
}
|
||||
public override void OnStartup()
|
||||
{
|
||||
@@ -77,12 +85,13 @@ public class RvApp : ExternalApplication
|
||||
_ = new TabManagerApp(Application);
|
||||
_ = new FamilyApp(Application, UiApplication);
|
||||
|
||||
if (Properties.Settings.Default.AutoSave)
|
||||
if (Properties.Settings.Default.IsActiveAutoSave)
|
||||
{
|
||||
Variables.Timer.Elapsed -= OnTimedEvent;
|
||||
Variables.Timer.Elapsed += OnTimedEvent;
|
||||
Variables.Timer.Interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
|
||||
Variables.Timer.Start();
|
||||
var interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
|
||||
saveTimer.Interval = interval;
|
||||
saveTimer.Elapsed -= OnTimedEvent;
|
||||
saveTimer.Elapsed += OnTimedEvent;
|
||||
saveTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,16 +222,29 @@ public class RvApp : ExternalApplication
|
||||
"将可以翻转工作平面的族实例,翻转其工作平面"
|
||||
);
|
||||
var rotateInstance = UIAssist.NewPushButtonData<RotateInstanceCmd>(
|
||||
"旋转实例",
|
||||
"旋转管件实例",
|
||||
Resources.rotate_instance_32px,
|
||||
Resources.rotate_instance_16px,
|
||||
"将族实例根据已连接的情况进行旋转"
|
||||
"将管件族实例根据已连接的情况进行旋转"
|
||||
);
|
||||
var addInsulation = UIAssist.NewPushButtonData<AddInsulationCmd>(
|
||||
"保温层",
|
||||
Resources.add_insulation_32px,
|
||||
Resources.add_insulation_16px,
|
||||
"对水管和风管添加保温层"
|
||||
);
|
||||
var arrangeMEPCurve = UIAssist.NewPushButtonData<ArrangeMEPCurveCmd>(
|
||||
"整理管线",
|
||||
Resources.arrange_mep_32px,
|
||||
Resources.arrange_mep_16px,
|
||||
"根据相对位置排布管线"
|
||||
);
|
||||
|
||||
panel.AddStackedItems(standMepCurve, anyConnect, moveConnect);
|
||||
panel.AddStackedItems(correctSlope, moveMEP, bloomConnector);
|
||||
panel.AddStackedItems(breakMepCurveBtn, disConnect, terminalConnect);
|
||||
panel.AddStackedItems(flipWorkplane, rotateInstance);
|
||||
panel.AddStackedItems(addInsulation, arrangeMEPCurve);
|
||||
panel.AddStackedItems(clashResolve, clashReport, headroomCheck);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user