566 lines
20 KiB
C#
566 lines
20 KiB
C#
using Autodesk.Revit.DB;
|
|
using KDCS.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace KMBIM
|
|
{
|
|
public partial class Form_settings : System.Windows.Forms.Form
|
|
{
|
|
public Document m_doc;
|
|
public Form_settings()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void settings_Load(object sender, EventArgs e)
|
|
{
|
|
this.KeyPreview = true;
|
|
|
|
//소방은 옵션이 없어 숨김
|
|
btn_Fire.Hide();
|
|
|
|
//유틸리티/////////////////////////////////////////////////
|
|
Util_Setting();
|
|
//배관/////////////////////////////////////////////////////
|
|
Pipe_Setting();
|
|
//설치/////////////////////////////////////////////////////
|
|
Install_Setting();
|
|
//편집/////////////////////////////////////////////////////
|
|
Edit_Setting();
|
|
//단열 슬리브//////////////////////////////////////////////
|
|
Sleeve_Setting();
|
|
//문서화//////////////////////////////////////////////
|
|
Document_Setting();
|
|
//덕트//////////////////////////////////////////////
|
|
Duct_Setting();
|
|
}
|
|
|
|
//유틸리티
|
|
private void Util_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******간섭회피********
|
|
//여유공간 높이
|
|
if (Reg.getReg("Avoid_Height") != "" || Reg.getReg("Avoid_Height") != string.Empty)
|
|
{
|
|
double hgt = Convert.ToDouble(Reg.getReg("Avoid_Height"));
|
|
Setting_numericUpDownFreeSpaceHeight.Value = (decimal)hgt;
|
|
}
|
|
|
|
//각도
|
|
if (Reg.getReg("Avoid_Angle") != "" || Reg.getReg("Avoid_Angle") != string.Empty)
|
|
{
|
|
double ang = Convert.ToInt32(Reg.getReg("Avoid_Angle"));
|
|
Setting_numericUpDownAngle.Value = (decimal)ang;
|
|
}
|
|
|
|
}
|
|
|
|
//배관
|
|
private void Pipe_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******간격조정********
|
|
//간격 입력
|
|
if (Reg.getReg("Interval_Offset") != "" || Reg.getReg("Interval_Offset") != string.Empty)
|
|
{
|
|
txt_IntervalDist.Text = Reg.getReg("Interval_Offset");
|
|
}
|
|
else
|
|
{
|
|
//기본값 150
|
|
txt_IntervalDist.Text = "150";
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******한본********
|
|
//절단 길이
|
|
if (Reg.getReg("Trim_Pipe_Length") != "" || Reg.getReg("Trim_Pipe_Length") != string.Empty)
|
|
{
|
|
txt_cuttingDIst.Text = Reg.getReg("Trim_Pipe_Length");
|
|
}
|
|
else
|
|
{
|
|
//기본값 150
|
|
txt_cuttingDIst.Text = "6";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//설치
|
|
private void Install_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******하단가대********
|
|
//가대 말단 거리
|
|
if (Reg.getReg("Rack_MarginDist") != "" || Reg.getReg("Rack_MarginDist") != string.Empty)
|
|
{
|
|
txt_RackMarginDist.Text = Reg.getReg("Rack_MarginDist");
|
|
}
|
|
else
|
|
{
|
|
//가대 말단 거리 기본값 200
|
|
txt_RackMarginDist.Text = "200";
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******행거********
|
|
//행거 간격
|
|
if (Reg.getReg("textBoxHangerSpacing") != "" || Reg.getReg("textBoxHangerSpacing") != string.Empty)
|
|
txt_HangerDist.Text = Reg.getReg("textBoxHangerSpacing");
|
|
else
|
|
{
|
|
//행거 간격 기본값 500
|
|
txt_HangerDist.Text = "500";
|
|
}
|
|
|
|
//조인트로부터 거리
|
|
if (Reg.getReg("textBoxDistanceFromJoint") != "" || Reg.getReg("textBoxDistanceFromJoint") != string.Empty)
|
|
txt_JointDist.Text = Reg.getReg("textBoxDistanceFromJoint");
|
|
else
|
|
{
|
|
//행거 조인트로부터 거리 기본값 300
|
|
txt_JointDist.Text = "300";
|
|
}
|
|
|
|
}
|
|
|
|
//편집
|
|
private void Edit_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******부품간격********
|
|
//거리
|
|
if (Reg.getReg("PartSpacing_Dist") != "" || Reg.getReg("PartSpacing_Dist") != string.Empty)
|
|
{
|
|
txt_partsDist.Text = Reg.getReg("PartSpacing_Dist");
|
|
}
|
|
else
|
|
{
|
|
//부품간격 거리 기본값 100
|
|
txt_partsDist.Text = "100";
|
|
}
|
|
|
|
}
|
|
|
|
//단열 슬리브
|
|
private void Sleeve_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******슬리브********
|
|
//배관 여유 공간
|
|
if (Reg.getReg("Sleeve_PipeOffset") != "" || Reg.getReg("Sleeve_PipeOffset") != string.Empty)
|
|
{
|
|
txt_SleevePipeFreeSpace.Text = Reg.getReg("Sleeve_PipeOffset");
|
|
}
|
|
else
|
|
{
|
|
//배관 여유 공간 기본값 50
|
|
txt_SleevePipeFreeSpace.Text = "50";
|
|
}
|
|
|
|
//덕트 여유 공간
|
|
if (Reg.getReg("Sleeve_DuctOffset") != "" || Reg.getReg("Sleeve_DuctOffset") != string.Empty)
|
|
{
|
|
txt_SleeveDuctFreeSpace.Text = Reg.getReg("Sleeve_DuctOffset");
|
|
}
|
|
else
|
|
{
|
|
//덕트 여유 공간 기본값 50
|
|
txt_SleeveDuctFreeSpace.Text = "50";
|
|
}
|
|
|
|
}
|
|
|
|
//문서화
|
|
private void Document_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******일괄치수********
|
|
//수직 간격
|
|
if (Reg.getReg("Tag_VirticalDist") != "" || Reg.getReg("Tag_VirticalDist") != string.Empty)
|
|
{
|
|
txt_MtagVertical.Text = Reg.getReg("Tag_VirticalDist");
|
|
}
|
|
else
|
|
{
|
|
//수직 간격 기본값 500
|
|
txt_MtagVertical.Text = "500";
|
|
}
|
|
|
|
//수평 간격
|
|
if (Reg.getReg("Tag_HorizontalDist") != "" || Reg.getReg("Tag_HorizontalDist") != string.Empty)
|
|
{
|
|
txt_MtagHorizontal.Text = Reg.getReg("Tag_HorizontalDist");
|
|
}
|
|
else
|
|
{
|
|
//수평 간격 기본값 700
|
|
txt_MtagHorizontal.Text = "500";
|
|
}
|
|
}
|
|
|
|
//덕트
|
|
private void Duct_Setting()
|
|
{
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******플랜지********
|
|
//절단 길이
|
|
if (Reg.getReg("Trim_Duct_Length") != "" || Reg.getReg("Trim_Duct_Length") != string.Empty)
|
|
{
|
|
txt_FlangeCutDist.Text = Reg.getReg("Trim_Duct_Length");
|
|
}
|
|
else
|
|
{
|
|
//절단 길이 기본값 1740
|
|
txt_FlangeCutDist.Text = "1740";
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******유틸리티********
|
|
//간섭회피 여유공간 높이
|
|
private void Setting_numericUpDownFreeSpaceHeight_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
Reg.setReg("Avoid_Height", Setting_numericUpDownFreeSpaceHeight.Value.ToString());
|
|
}
|
|
//간섭회피 각도
|
|
private void Setting_numericUpDownAngle_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
Reg.setReg("Avoid_Angle", Setting_numericUpDownAngle.Value.ToString());
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******배관********
|
|
//간격조정 간격 입력
|
|
private void txt_IntervalDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_IntervalDist.Text == "") return;
|
|
if (txt_IntervalDist.Text != "-")
|
|
{
|
|
Reg.setReg("Interval_Offset", txt_IntervalDist.Text.ToString());
|
|
}
|
|
|
|
}
|
|
//한본 절단길이
|
|
private void txt_cuttingDIst_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_cuttingDIst.Text == "") return;
|
|
if (txt_cuttingDIst.Text != "-")
|
|
{
|
|
Reg.setReg("Trim_Pipe_Length", txt_cuttingDIst.Text.ToString());
|
|
}
|
|
}
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******설치********
|
|
//하단가대 가대 말단 거리
|
|
private void txt_RackMarginDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_RackMarginDist.Text == "") return;
|
|
if (txt_RackMarginDist.Text != "-")
|
|
{
|
|
Reg.setReg("Rack_MarginDist", txt_RackMarginDist.Text.ToString());
|
|
}
|
|
}
|
|
|
|
//행거 행거 간격
|
|
private void txt_HangerDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_HangerDist.Text == "") return;
|
|
if (txt_HangerDist.Text != "-")
|
|
Reg.setReg("textBoxHangerSpacing", txt_HangerDist.Text);
|
|
|
|
}
|
|
|
|
//행거 조인트로부터 거리
|
|
private void txt_JointDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_JointDist.Text == "") return;
|
|
if (txt_JointDist.Text != "-")
|
|
Reg.setReg("textBoxDistanceFromJoint", txt_JointDist.Text);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******편집********
|
|
//부품간격 거리
|
|
private void txt_partsDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_partsDist.Text == "") return;
|
|
if (txt_partsDist.Text != "-")
|
|
Reg.setReg("PartSpacing_Dist", txt_partsDist.Text);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******단열슬리브********
|
|
//슬리브 배관여유공간
|
|
private void txt_SleevePipeFreeSpace_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_SleevePipeFreeSpace.Text == "") return;
|
|
if (txt_SleevePipeFreeSpace.Text != "-")
|
|
Reg.setReg("Sleeve_PipeOffset", txt_SleevePipeFreeSpace.Text);
|
|
}
|
|
//슬리브 덕트여유공간
|
|
private void txt_SleeveDuctFreeSpace_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_SleeveDuctFreeSpace.Text == "") return;
|
|
if (txt_SleeveDuctFreeSpace.Text != "-")
|
|
Reg.setReg("Sleeve_DuctOffset", txt_SleeveDuctFreeSpace.Text);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******문서화********
|
|
//일괄치수 수직간격
|
|
private void txt_MtagVertical_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_MtagVertical.Text == "") return;
|
|
if (txt_MtagVertical.Text != "-")
|
|
{
|
|
Reg.setReg("Tag_VirticalDist", txt_MtagVertical.Text);
|
|
}
|
|
}
|
|
//일괄치수 수평간격
|
|
private void txt_MtagHorizontal_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_MtagHorizontal.Text == "") return;
|
|
if (txt_MtagHorizontal.Text != "-")
|
|
{
|
|
Reg.setReg("Tag_HorizontalDist", txt_MtagHorizontal.Text);
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------//
|
|
//*******덕트********
|
|
//플랜지 절단길이
|
|
private void txt_FlangeCutDist_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_FlangeCutDist.Text == "") return;
|
|
if (txt_FlangeCutDist.Text != "-")
|
|
{
|
|
Reg.setReg("Trim_Duct_Length", txt_FlangeCutDist.Text);
|
|
}
|
|
}
|
|
|
|
private void btn_Util_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 0;
|
|
}
|
|
|
|
private void btn_Pipe_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 1;
|
|
}
|
|
|
|
private void btn_Install_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 2;
|
|
}
|
|
|
|
private void btn_Edit_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 3;
|
|
}
|
|
|
|
private void btn_Fire_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 4;
|
|
}
|
|
|
|
private void btn_Sleeve_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 5;
|
|
}
|
|
|
|
private void btn_Document_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 6;
|
|
}
|
|
private void btn_Duct_Click(object sender, EventArgs e)
|
|
{
|
|
tabSettings.SelectedIndex = 7;
|
|
}
|
|
|
|
private void Form_settings_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Escape)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
else if (e.KeyCode == Keys.Enter)
|
|
{
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#region 텍스트박스 숫자,'.','-'만 넣는 이벤트
|
|
private void Setting_numericUpDownFreeSpaceHeight_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
private void Setting_numericUpDownAngle_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
}
|
|
|
|
private void txt_IntervalDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_IntervalDist.Text) || txt_IntervalDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_cuttingDIst_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_cuttingDIst.Text) || txt_cuttingDIst.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_RackMarginDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_RackMarginDist.Text) || txt_RackMarginDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_HangerDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_HangerDist.Text) || txt_HangerDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_JointDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_JointDist.Text) || txt_JointDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_partsDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_partsDist.Text) || txt_partsDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_SleevePipeFreeSpace_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_SleevePipeFreeSpace.Text) || txt_SleevePipeFreeSpace.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_SleeveDuctFreeSpace_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_SleeveDuctFreeSpace.Text) || txt_SleeveDuctFreeSpace.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_MtagVertical_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_MtagVertical.Text) || txt_MtagVertical.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_MtagHorizontal_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_MtagHorizontal.Text) || txt_MtagHorizontal.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_FlangeCutDist_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
int keyCode = (int)e.KeyChar;
|
|
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46)
|
|
e.Handled = true;
|
|
|
|
if (keyCode == 46)
|
|
{
|
|
if (string.IsNullOrEmpty(txt_FlangeCutDist.Text) || txt_FlangeCutDist.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|