90 lines
2.7 KiB
C#
90 lines
2.7 KiB
C#
using KMBIM.Revit.Tools.Utils;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace KMBIM.Revit.Tools.Cmd.Hanger
|
|
{
|
|
[Serializable]
|
|
class HangerSettings
|
|
{
|
|
|
|
public const string Diameter = "Diameter";
|
|
public const string Width = "Width";
|
|
public const string Height = "Height";
|
|
public const string AnchorElevation = "AnchorElevation";
|
|
public const string CenterElevation = "CenterElevation";
|
|
public const string Settings = "Settings";
|
|
|
|
public List<InstallOption> InstallOptions { get; set; }
|
|
public bool PipeInsulation { get; set; } // 배관 보온재 고려
|
|
public bool DuctInsulation { get; set; } // 덕트 보온재 고려
|
|
|
|
public EnumAnchorInstallBase AnchorInstallBase { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public string LibraryRoot { get; set; }
|
|
|
|
|
|
private static string GetKMBIMLibraryFolder(string subFolder = "")
|
|
{
|
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "DCS.CO.KR\\KMBIM\\" + subFolder);
|
|
}
|
|
|
|
public HangerSettings()
|
|
{
|
|
string location = typeof(HangerSettings).Assembly.Location;
|
|
LibraryRoot = GetKMBIMLibraryFolder("\\Libraries");
|
|
DuctInsulation = true;
|
|
PipeInsulation = true;
|
|
AnchorInstallBase = EnumAnchorInstallBase.Structrual;
|
|
}
|
|
|
|
public static HangerSettings GetSettings()
|
|
{
|
|
return SettingManager.GetSetting<HangerSettings>("Settings", HangerSettings.GetSettingFile());
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 설정파일을 JSON 형태로 저장할 수 있도록 수정할 것
|
|
// HangerSettings hSettings = JsonConvert.DeserializeObject<HangerSettings>(strJson);
|
|
public static string GetSettingFile()
|
|
{
|
|
|
|
string text = GetKMBIMLibraryFolder();
|
|
string text2 = Path.Combine(text, "Setting.json"); // 설정 파일 저장
|
|
if (!File.Exists(text2))
|
|
{
|
|
if (!Directory.Exists(text))
|
|
{
|
|
Directory.CreateDirectory(text);
|
|
}
|
|
|
|
File.WriteAllText(text2, JsonConvert.SerializeObject(new HangerSettings()));
|
|
}
|
|
return text2;
|
|
}
|
|
|
|
// 레빗 표시 단위에 따른 행거 패밀리 폴더를 얻는다.
|
|
public static string GetHangerFolder()
|
|
{
|
|
|
|
|
|
return GetKMBIMLibraryFolder("Libraries\\Hanger");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|