增加保温层和整理管线的功能,修复自动保存功能等修复多个bug

This commit is contained in:
GG Z
2024-10-27 00:19:48 +08:00
parent b6647218be
commit 77655c9ef5
67 changed files with 3159 additions and 731 deletions

View File

@@ -10,7 +10,7 @@ namespace Sai.RvKits.RvCommon;
[Regeneration(RegenerationOption.Manual)]
public class AutoSaveCmd : ExternalCommand
{
private readonly System.Timers.Timer timer = Variables.Timer;
private readonly System.Timers.Timer timer = Variables.AutoSaveTimer;
public override void Execute()
{
if (string.IsNullOrEmpty(Document.PathName))
@@ -25,22 +25,20 @@ public class AutoSaveCmd : ExternalCommand
DataContext = viewModel
};
view.ShowDialog();
if (view.DialogResult == true)
if (Properties.Settings.Default.IsActiveAutoSave)
{
if (Properties.Settings.Default.AutoSave)
if (Properties.Settings.Default.AutoSaveIntervalTime >= 1)
{
if (Properties.Settings.Default.AutoSaveIntervalTime >= 1)
{
timer.Interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
}
timer.Interval = Properties.Settings.Default.AutoSaveIntervalTime * 60 * 1000;
Properties.Settings.Default.Save();
//timer.Enabled = Properties.Settings.Default.AutoSave;
timer.Start();
}
else
{
timer.Stop();
}
//timer.Enabled = Properties.Settings.Default.AutoSave;
timer.Start();
}
else
{
timer.Stop();
}
Result = Result.Succeeded;
}

View File

@@ -1,5 +1,6 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@@ -7,27 +8,33 @@ namespace Sai.RvKits.RvCommon;
public partial class AutoSaveViewModel : ObservableValidator
{
public AutoSaveViewModel()
{
IsActiveAutoSave = Properties.Settings.Default.IsActiveAutoSave;
IntervalTime = Properties.Settings.Default.AutoSaveIntervalTime;
}
public AutoSaveViewModel()
{
IsActiveAutoSave = Properties.Settings.Default.IsActiveAutoSave;
IntervalTime = Properties.Settings.Default.AutoSaveIntervalTime;
}
[ObservableProperty]
private bool isActiveAutoSave;
private bool isActiveAutoSave;
//partial void OnIsActiveAutoSaveChanged(bool value)
//{
// throw new NotImplementedException();
//}
[Required(ErrorMessage = "不可为空")]
[DefaultValue(15)]
[DefaultValue(10)]
[NotifyDataErrorInfo]
[Range(5, 30, ErrorMessage = "输入值应在5~30分钟之间")]
[Range(1, 30, ErrorMessage = "输入值应在1~30分钟之间")]
[ObservableProperty]
private int intervalTime;
[RelayCommand]
private void Closing()
{
Properties.Settings.Default.IsActiveAutoSave = IsActiveAutoSave;
Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
Properties.Settings.Default.Save();
}
[RelayCommand]
private void Closing()
{
Properties.Settings.Default.IsActiveAutoSave = IsActiveAutoSave;
Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
Properties.Settings.Default.Save();
Variables.AutoSaveTimer.Interval = IntervalTime * 60 * 1000;
}
}

View File

@@ -249,7 +249,7 @@ public partial class InstanceCreatorViewModel : ObservableObject
// }
// var dwg = doc.GetElement(textRefer) as ImportInstance;
// var textLayerName = dwg.GetLayerName(textRefer);
// var path = dwg.GetDwgPath();
// var path = dwg.GetFilePath();
// var dwgTransform = dwg.GetTotalTransform();
// using ACadSharp.IO.DwgReader reader = new(path);

View File

@@ -26,7 +26,7 @@ public class ModifyModelParams : ExternalCommand
var textRefer = UiDocument.Selection.PickObject(ObjectType.PointOnElement, "请选择管线标注文字");
var dwg = Document.GetElement(textRefer) as ImportInstance;
var textLayerName = dwg.GetLayerName(textRefer);
var path = dwg.GetDwgPath();
var path = dwg.GetFilePath();
var dwgTransform = dwg!.GetTransform();
Document.Invoke(_ =>
{

View File

@@ -81,7 +81,7 @@ public partial class PipesCreatorViewModel : ObservableObject
doc.ActiveView.SetCategoryHidden(curve.GraphicsStyleId, false);
doc.ActiveView.SetCategoryHidden(text.GraphicsStyleId, false);
});
var path = dwg.GetDwgPath();
var path = dwg.GetFilePath();
using ACadSharp.IO.DwgReader reader = new(path);
var cadDocument = reader.Read();
//var blocks = cadDocument.Entities.OfType<ACadSharp.Entities.Insert>().Where(e => e.Layer.Name == layerName).ToList();