FileOptions = 'Двери.xml'; // файл с параметрами
MakeProperties (); //Открываем окно с параметрами
Action.Properties.Load(FileOptions);// считываем параметры из файла "Двери"
Action.OnFinish = function () {
Action.Properties.Save(FileOptions); //сохраняем изменения
}
while (true)
{
LeftPan = GetPanel('Укажите левую панель');
RightPan = GetPanel('Укажите правую панель');
Left = LeftPan.GabMin.x;
Right = RightPan.GabMax.x;
SetCamera(p3dFront);//ставим вид спереди
TopEd = GetEdge("Укажите верхнюю границу", AxisX).First.y ;
BotEd = GetEdge("Укажите нижнюю границу", AxisX) .First.y ;
SetCamera(p3dIsometric);
Front = GetEdge('Укажите переднюю границу', AxisY).First.z;
Make();
}
Action.Continue();
function MakeProperties () {
Prop = Action.Properties;
Dveri = Prop.NewGroup('Двери')
MatDv = Dveri.NewMaterial('Материал дверей');
DverLR = Dveri.NewCombo('Открывание', 'Влево\nВправо\nДве двери');
OH = Dveri.NewNumber('Фуга гор-ная', 1.5);
OV = Dveri.NewNumber('Фуга верт-ная', 1.5);
TP = Dveri.NewNumber('Толщина боковин', 16);
Furn = Prop.NewGroup('Фурнитура')
Petli = Furn.NewFurniture('Петли');
LP = Furn.NewNumber('Расстояние до петель', 100);
FurnDP = Furn.NewCombo('Кол-во петель', '2\n3\n4\n5');
OkBtn = Prop.NewButton('Продолжить');//Добавим кнопку
OkBtn.OnClick = function() {
Action.Commit();
//NewDveri();
}
OkBtn = Prop.NewButton('Закончить'); //Добавим кнопку
OkBtn.OnClick = function() {
Make();
Action.Finish();
}
Prop.OnChange = function(){
Make();
};
}
function Make() {
DeleteNewObjects(); //очистим
MatDv.SetActive(); //активируем материал двери
Thick = ActiveMaterial.Thickness;//толщина материала
Width = Right - Left;
Height = TopEd - BotEd;
h1 = (Height/2) + BotEd;
x1 = Left + OV.Value;
x2 = Right - OV.Value;
y1 = BotEd + OH.Value;
y2 = TopEd - OH.Value;
c = (Width/2) + Left;
c1 = c - OV.Value;
c2 = c + OV.Value;
z1 = Front;
h2 = (Height - OH.Value*2 - LP.Value*2)/3;
h2 = Math.round(h2);
h3 = (Height - OH.Value*2 - LP.Value*2)/4;
h3 = Math.round(h3);
if (DverLR.ItemIndex == 0){ //левая дверь
DverL = AddFrontPanel(x1, y1, x2, y2, z1);
DverL.Name = 'дверь левая';
DverL.TextureOrientation = TextureOrientation.Vertical;
FPetli = Petli.Value;
if (FurnDP.ItemIndex == 0){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
}
if (FurnDP.ItemIndex == 1){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, h1, 0);
}
if (FurnDP.ItemIndex == 2){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value + h2, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value - h2, 0);
}
if (FurnDP.ItemIndex == 3){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, h1, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value + h3, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value - h3, 0);
}
}
if (DverLR.ItemIndex == 1){ //правая дверь
DverR = AddFrontPanel(x1, y1, x2, y2, z1);
DverR.Name = 'дверь правая';
DverR.TextureOrientation = TextureOrientation.Vertical;
FPetli = Petli.Value;
if (FurnDP.ItemIndex == 0){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
}
if (FurnDP.ItemIndex == 1){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, h1, 0);
}
if (FurnDP.ItemIndex == 2){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value + h2, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value - h2, 0);
}
if (FurnDP.ItemIndex == 3){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, h1, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value + h3, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value - h3, 0);
}
}
if (DverLR.ItemIndex == 2){ //две двери
DverL = AddFrontPanel(x1, y1, c1, y2, z1);
DverL.Name = 'дверь левая'; //строим левую дверь
DverL.TextureOrientation = TextureOrientation.Vertical;
FPetli = Petli.Value;
if (FurnDP.ItemIndex == 0){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
}
if (FurnDP.ItemIndex == 1){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, h1, 0);
}
if (FurnDP.ItemIndex == 2){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value + h2, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value - h2, 0);
}
if (FurnDP.ItemIndex == 3){
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, h1, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y1 + LP.Value + h3, 0);
FPetli.Mount(LeftPan, DverL, Left + TP.Value, y2 - LP.Value - h3, 0);
}
DverR = AddFrontPanel(c2, y1, x2, y2, z1);
DverR.Name = 'дверь правая'; //строим правую дверь
DverL.TextureOrientation = TextureOrientation.Vertical;
FPetli = Petli.Value;
if (FurnDP.ItemIndex == 0){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
}
if (FurnDP.ItemIndex == 1){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, h1, 0);
}
if (FurnDP.ItemIndex == 2){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value + h2, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value - h2, 0);
}
if (FurnDP.ItemIndex == 3){
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, h1, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y1 + LP.Value + h3, 0);
FPetli.Mount(RightPan, DverR, Right - TP.Value, y2 - LP.Value - h3, 0);
}
}
}
[свернуть]