Показать сообщение отдельно
Старый 17.09.2018, 15:41   #1007
DSS
Новичок
 
Регистрация: 01.02.2013
Сообщений: 17
Сказал(а) спасибо: 2
Поблагодарили 0 раз(а) в 0 сообщениях
Вес репутации: 0
DSS пока не определено
По умолчанию

Пример скрипта для 5 полок. Раскидывает с условием центр сверления для подполочника равен целому числу.

Код

Код:
// Установка полок в секцию
ShelfCount = NewNumberInput('Количество полок');
ShelfCount.Value = 5;
KrMat = NewButtMaterialInput("Кромка");

SetCamera(p3dFront);
LeftPanel = GetPanel('Укажите левую панель');
RightPanel = GetPanel('Укажите правую панель');
Left = LeftPanel.GabMax.x;
Right = RightPanel.GabMin.x;
Top = GetEdge('Укажите верхнюю границу', AxisX).First.y;
Bottom = GetEdge('Укажите нижнюю границу', AxisX).First.y;

SetCamera(p3dLeft);
Back = GetEdge('Укажите заднюю границу', AxisY).First.z;
Front = GetEdge('Укажите переднюю границу', AxisY).First.z;

Offset = 1;
Offset2 = 0;
Offset3 = 10;
OP = 64; //Отступы полкодержателей друг от друга
OB = 32; //Отступ от задней границы
OF = 32; //Отступ от передней границы
Count = ShelfCount.Value;
Thick = ActiveMaterial.Thickness;

PosY = Bottom;
SectionHeight = Top - Bottom;
YInc = (SectionHeight - Count * Thick) / (Count + 1);
YInc = Math.round(YInc);

LCorner = OpenFurniture('Крепёж\\Полкодержатель2.f3d');

for (var k = 0; k < Count; k++) {
    PosY += YInc;
    Panel = AddHorizPanel(Left + Offset, Back + Offset2, Right - Offset,
        Front - Offset3, PosY + 0.5);
    Panel.TextureOrientation = ftoHorizontal;
    Panel.Name = 'Полка';

    PosY += Thick;
    for (i = 0; i < Panel.Contour.Count; i++) {
            Panel.AddButt(KrMat, i);
        }
}

LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5 + OP, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5 - OP, Back + OB, 0);

LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5 + OP, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc + 0.5 - OP, Front - OF, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5 + OP, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5 - OP, Back + OB, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5 + OP, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc + 0.5 - OP, Front - OF, 0);


LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick + OP, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick - OP, Back + OB, 0);

LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick + OP, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 2 + 0.5 + Thick - OP, Front - OF, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick + OP, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick - OP, Back + OB, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick + OP, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 2 + 0.5 + Thick - OP, Front - OF, 0);


LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2 + OP, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2 - OP, Back + OB, 0);

LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2 + OP, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 3 + 0.5 + Thick * 2 - OP, Front - OF, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2 + OP, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2 - OP, Back + OB, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2 + OP, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 3 + 0.5 + Thick * 2 - OP, Front - OF, 0);


LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3 + OP, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3 - OP, Back + OB, 0);

LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3 + OP, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 4 + 0.5 + Thick * 3 - OP, Front - OF, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3 + OP, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3 - OP, Back + OB, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3 + OP, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 4 + 0.5 + Thick * 3 - OP, Front - OF, 0);



LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4 + OP, Back + OB, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4 - OP, Back + OB, 0);

LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4 + OP, Front - OF, 0);
LCorner.Mount1(LeftPanel, Left, Bottom + YInc * 5 + 0.5 + Thick * 4 - OP, Front - OF, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4 + OP, Back + OB, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4 - OP, Back + OB, 0);

LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4 + OP, Front - OF, 0);
LCorner.Mount1(RightPanel, Right, Bottom + YInc * 5 + 0.5 + Thick * 4 - OP, Front - OF, 0);

SetCamera(p3dFront);
[свернуть]

Последний раз редактировалось DSS; 17.09.2018 в 16:32. Причина: Загнал код в спойлер
DSS вне форума   Ответить с цитированием Вверх