Skip to content

Commit

Permalink
Bim electrical продолжение
Browse files Browse the repository at this point in the history
  • Loading branch information
veb86 committed Apr 23, 2024
1 parent 89057a8 commit a8ee169
Show file tree
Hide file tree
Showing 20 changed files with 2,149 additions and 642 deletions.
130 changes: 73 additions & 57 deletions cad_source/zcad/velec/managerem/uzvmodeltoxlsx.pas
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ TVXLSXCELL=record
zimportcabFT= '</zimportcab>';
zalldevexportetalon='<zall>DEVEXPORT';
zalldevexport='zallDEVEXPORT';

//Константы для выгрузки всех кабелей
zallcabexportetalonset='<zall>CABSET';
zallcabexportetalon='<zall>CAB';
zallcabexport='zallCAB';
zallcabcodeNameEtalon='<zall>';
Expand Down Expand Up @@ -321,6 +324,14 @@ //TSortComparer=class
pvd2:=FindVariableInEnt(ourDev,velec_nameDevice);
if pvd2<>nil then
ZCMsgCallBackInterface.TextMessage(' - устройство с именем = '+pstring(pvd2^.data.Addr.Instance)^,TMWOHistoryOut);
pvd2:=FindVariableInEnt(ourDev,velec_ANALYSISEM_exporttoxlsx);
if pvd2<>nil then
begin
if pboolean(pvd2^.data.Addr.Instance)^ = false then begin
ZCMsgCallBackInterface.TextMessage(' - Анализ данного устройства отменен',TMWOHistoryOut);
continue;
end;
end;

// Заполняем всю информацию по устройству
//ZCMsgCallBackInterface.TextMessage('1',TMWOHistoryOut);
Expand Down Expand Up @@ -926,29 +937,8 @@ procedure zallimportcabsetcommand(listGraphEM:TListGraphDev;nameEtalon,nameNewSh
numRow:Cardinal;
valueCell,newNameSheet:string;
begin
//Получаем исключительно граф в котором головное устройство данное устройство
//graphDev:=uzvmanemgetgem.getGraphHeadDev(listFullGraphEM,devMaincFunc,listAllHeadDev);

//Получаем досутп к переменной с именим устройства
//pvd:=FindVariableInEnt(graphDev.Root.getDevice,velec_nameDevice);
//if pvd<>nil then
// namePanel:=pstring(pvd^.data.Addr.Instance)^; // Имя устройства

//ZCMsgCallBackInterface.TextMessage('Имя ГУ = '+pstring(pvd^.data.Addr.Instance)^,TMWOHistoryOut);

//Получаем досутп к переменной с именим заполняемого листа
//pvd:=FindVariableInEnt(graphDev.Root.getDevice,uzvconsts.velec_nametemplatesxlsx);
//if pvd<>nil then
// nameSET:=pstring(pvd^.data.Addr.Instance)^; // Имя устройства

//nameSET:='<zlight>';

//ZCMsgCallBackInterface.TextMessage('Имя заполняемого листа = '+nameSET,TMWOHistoryOut);

//Здесь будет место где я буду получать какие настройки будут подключаться
//nameSET:='<zlight>'; //Данное имя всегда будет менятся на имя щита

numRow:=1;
numRow:=1; //начало с первой строки
//Получаем значение ячейки 1,1 в настройках для данного кода листа
valueCell:=uzvzcadxlsxole.getCellValue(nameEtalon+'SET',numRow,1);

Expand All @@ -957,25 +947,52 @@ procedure zallimportcabsetcommand(listGraphEM:TListGraphDev;nameEtalon,nameNewSh

While AnsiPos(nameEtalon, valueCell) > 0 do
begin
//if AnsiPos(nameSET, valueCell) > 0 then
//begin
//Создаем копию листа эталона
newNameSheet:=StringReplace(valueCell, nameEtalon, nameNewSheet,[rfReplaceAll, rfIgnoreCase]);
uzvzcadxlsxole.copyWorksheetName(valueCell,newNameSheet);
ZCMsgCallBackInterface.TextMessage('Создаем новый лист ='+newNameSheet,TMWOHistoryOut);

//Проверяем существует ли данный эталонный лист
if uzvzcadxlsxole.getNumWorkSheetName(valueCell)>0 then begin
//Создаем копию листа эталона
newNameSheet:=StringReplace(valueCell, nameEtalon, nameNewSheet,[rfReplaceAll, rfIgnoreCase]);
uzvzcadxlsxole.copyWorksheetName(valueCell,newNameSheet);
ZCMsgCallBackInterface.TextMessage('Создаем новый лист ='+newNameSheet,TMWOHistoryOut);

//Передаем имя эталона и имя нового листа в генерацию листа
if remotemode then
ZCMsgCallBackInterface.TextMessage('generatorSheet(graphDev,valueCell,newNameSheet)',TMWOHistoryOut);

//for i:=0 to Length(arrayCodeName)-1 do
//begin
// //ZCMsgCallBackInterface.TextMessage('имя = '+ arrayCodeName[i],TMWOHistoryOut);
// uzvzcadxlsxole.searchCellRowCol(nameEtalon,arrayCodeName[i],stInfoDevCell.vRow,stInfoDevCell.vCol);
// if stInfoDevCell.vRow > 0 then
// begin
// Case i of
// 0: zimportrootdevcommand(graphDev,nameEtalon,nameSheet,stInfoDevCell.vRow,stInfoDevCell.vCol);//ZCMsgCallBackInterface.TextMessage('<zimportrootdev запускаем! ',TMWOHistoryOut);//'<zcopycol'
// 1: zimportdevcommand(graphDev,nameEtalon,nameSheet,stInfoDevCell.vRow,stInfoDevCell.vCol);//ZCMsgCallBackInterface.TextMessage('<zimportdev запускаем! ',TMWOHistoryOut);//<zimportdev
// 2: zimportcabcommand(graphDev,nameEtalon,nameSheet,stInfoDevCell.vRow,stInfoDevCell.vCol);//ZCMsgCallBackInterface.TextMessage('<zimportcab запускаем! ',TMWOHistoryOut);//<zimportcab
// 3: zcopyrowcommand(nameEtalon,nameSheet,stInfoDevCell.vRow,stInfoDevCell.vCol); //<zcopyrow
// 4: ZCMsgCallBackInterface.TextMessage('<zcopycol запускаем! ',TMWOHistoryOut);//'<zcopycol'
// 5: zallimportcabcommand(listGraphEM,nameEtalon,nameSheet);
// else
// ZCMsgCallBackInterface.TextMessage('ОШИБКА в КАСЕ!!! ',TMWOHistoryOut);
// end;
// end;
//end;

generatorSheet(nil,valueCell,newNameSheet,listGraphEM); //здесь запускается самое главное, ищутся спец коды и заполняются
//end;

end else begin
ZCMsgCallBackInterface.TextMessage('Эталонный лист = '+valueCell + ' - ОТСУТСТВУЕТ!!!',TMWOHistoryOut);
end;

//делаем следующий шаг
inc(numRow);
valueCell:=uzvzcadxlsxole.getCellValue(nameEtalon+'SET',numRow,1);

if remotemode then
ZCMsgCallBackInterface.TextMessage('Значение ячейки = '+valueCell + ', номер позиции = ' +inttostr(AnsiPos(nameEtalon, valueCell)),TMWOHistoryOut);
end;
//until AnsiPos(nameSET, valueCell) > 0;
valueCell:=uzvzcadxlsxole.getCellValue(nameEtalon+'SET',numRow,1);
//valueCell:=uzvzcadxlsxole.getCellValue(nameEtalon+'SET',numRow,1);

end;

Expand Down Expand Up @@ -1261,6 +1278,7 @@ function vExportModelToXLSX_com(const Context:TZCADCommandContext;operands:TComm
//Получить список всех древовидно ориентированных графов из которых состоит модель
//listFullGraphEM:=TListGraphDev.Create;
listFullGraphEM:=uzvmanemgetgem.getListGrapghEM; //ВСЕ ХОРоШо

////ZCMsgCallBackInterface.TextMessage('listFullGraphEM сайз = ' + inttostr(listFullGraphEM.Size),TMWOHistoryOut);
//for i:=0 to listFullGraphEM.Size-1 do begin
// ZCMsgCallBackInterface.TextMessage(' ===граф№ - ' + inttostr(i),TMWOHistoryOut);
Expand All @@ -1275,39 +1293,37 @@ function vExportModelToXLSX_com(const Context:TZCADCommandContext;operands:TComm
//**открываем книгу для работы
uzvzcadxlsxole.openXLSXFile(fileTemplate);
//**Обрабатываем листы которые производят вынос всех кабелей в один общий список
if uzvzcadxlsxole.getNumWorkSheetName(zallcabexportetalon)>0 then begin
//создаем копию листа для заполнения
//uzvzcadxlsxole.copyWorksheetName(zallcabexportetalon,zallcabexport);
//ZCMsgCallBackInterface.TextMessage('копия листа создана',TMWOHistoryOut);
if uzvzcadxlsxole.getNumWorkSheetName(zallcabexportetalonset)>0 then begin
//начинаем заполнять
zallimportcabsetcommand(listFullGraphEM,zallcabexportetalon,zallcabexport);
end;

//**получить список всех головных устройств (устройств централей)
////listAllHeadDev:=TListDev.Create;
//listAllHeadDev:=uzvmanemgetgem.getListMainFuncHeadDev(listFullGraphEM);
////ZCMsgCallBackInterface.TextMessage('listAllHeadDev сайз = ' + inttostr(listAllHeadDev.Size),TMWOHistoryOut);
//if remotemode then
// for devMaincFunc in listAllHeadDev do
// begin
// pvd:=FindVariableInEnt(devMaincFunc,velec_nameDevice);
// if pvd<>nil then
// begin
// ZCMsgCallBackInterface.TextMessage('Имя ГУ с учетом особенностей = '+pstring(pvd^.data.Addr.Instance)^,TMWOHistoryOut);
// end;
// //ZCMsgCallBackInterface.TextMessage('рисуем граф exportGraphModelToXLSX = СТАРТ ',TMWOHistoryOut);
// graphView:=uzvmanemgetgem.getGraphHeadDev(listFullGraphEM,devMaincFunc,listAllHeadDev);
// visualGraphTree(graphView,insertCoordination,3,depthVisual);
// graphView.Free;
// //ZCMsgCallBackInterface.TextMessage('рисуем граф exportGraphModelToXLSX = ФИНИШ ',TMWOHistoryOut);
// end;
//
////ZCMsgCallBackInterface.TextMessage('exportGraphModelToXLSX = СТАРТ ',TMWOHistoryOut);
//if not listAllHeadDev.IsEmpty then
// exportGraphModelToXLSX(listAllHeadDev,fileTemplate,newfilexlsx);
////ZCMsgCallBackInterface.TextMessage('exportGraphModelToXLSX = ФИНИШ ',TMWOHistoryOut);
listAllHeadDev:=TListDev.Create;
listAllHeadDev:=uzvmanemgetgem.getListMainFuncHeadDev(listFullGraphEM);
//ZCMsgCallBackInterface.TextMessage('listAllHeadDev сайз = ' + inttostr(listAllHeadDev.Size),TMWOHistoryOut);
if remotemode then
for devMaincFunc in listAllHeadDev do
begin
pvd:=FindVariableInEnt(devMaincFunc,velec_nameDevice);
if pvd<>nil then
begin
ZCMsgCallBackInterface.TextMessage('Имя ГУ с учетом особенностей = '+pstring(pvd^.data.Addr.Instance)^,TMWOHistoryOut);
end;
//ZCMsgCallBackInterface.TextMessage('рисуем граф exportGraphModelToXLSX = СТАРТ ',TMWOHistoryOut);
graphView:=uzvmanemgetgem.getGraphHeadDev(listFullGraphEM,devMaincFunc,listAllHeadDev);
visualGraphTree(graphView,insertCoordination,3,depthVisual);
graphView.Free;
//ZCMsgCallBackInterface.TextMessage('рисуем граф exportGraphModelToXLSX = ФИНИШ ',TMWOHistoryOut);
end;

//ZCMsgCallBackInterface.TextMessage('exportGraphModelToXLSX = СТАРТ ',TMWOHistoryOut);
if not listAllHeadDev.IsEmpty then
exportGraphModelToXLSX(listAllHeadDev,fileTemplate,newfilexlsx);
//ZCMsgCallBackInterface.TextMessage('exportGraphModelToXLSX = ФИНИШ ',TMWOHistoryOut);


//Обрабатываем специфические настройки для того, что бы потушить все листы которые нам не нужны в проекте и дать главному файлу имя
//Обрабатываем специфические настройки для того, что бы потушить все листы которые нам не нужны в проекте и дать главному файлу имя
//Получаем значение ячейки 1,1 в настройках для данного кода листа
numRow:=1;
valueCell:=uzvzcadxlsxole.getCellValue(woorkBookSET,numRow,1);
Expand Down
19 changes: 12 additions & 7 deletions cad_source/zcad/velec/managerem/uzvzcadxlsxole.pas
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,18 @@ function getNumWorkSheetName(nameSheet:string):integer; //-1 отсутству
i:integer;
begin
result:=-1;
for i:= 1 to BasicWorkbook.WorkSheets.count do
if ContainsText(BasicWorkbook.WorkSheets[i].Name, nameSheet) then
begin
result:=i;
//ZCMsgCallBackInterface.TextMessage('Лист = ' + BasicWorkbook.WorkSheets[i].Name + ' спрятан!',TMWOHistoryOut);
//BasicWorkbook.WorkSheets[i].Visible:=false;
end;
try
for i:= 1 to BasicWorkbook.WorkSheets.count do
//if ContainsText(BasicWorkbook.WorkSheets[i].Name, nameSheet) then
if BasicWorkbook.WorkSheets[i].Name = nameSheet then
begin
result:=i;
//ZCMsgCallBackInterface.TextMessage('Лист = ' + BasicWorkbook.WorkSheets[i].Name + ' спрятан!',TMWOHistoryOut);
//BasicWorkbook.WorkSheets[i].Visible:=false;
end;
except
ZCMsgCallBackInterface.TextMessage('ОШИБКА! Лист с именем ='+nameSheet + ' - ОТСУТСТВУЕТ',TMWOHistoryOut);
end;
end;

function saveXLSXFile(pathFile:string):boolean;
Expand Down
1 change: 1 addition & 0 deletions cad_source/zcad/velec/uzvconsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ interface
velec_GC_HeadDevice='GC_HeadDevice';
velec_GC_HDGroup='GC_HDGroup';
velec_ANALYSISEM_icanbeheadunit='ANALYSISEM_icanbeheadunit';
velec_ANALYSISEM_exporttoxlsx='ANALYSISEM_exporttoxlsx';
velec_nametemplatesxlsx='nametemplatesxlsx';


Expand Down
2 changes: 1 addition & 1 deletion cad_source/zcad/velec/uzvelscheme.pas
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ TInfoVertex=record

//выставляем клону точку вставки, ориентируем по осям, вращаем
pnevdev^.Local.P_insert:=currentcoord;
//pnevdev.Local.Basis.oz:=xy_Z_Vertex;
pnevdev^.scale:=createvertex(1,1,1);
//pnevdev.Local.Basis.ox:=_X_yzVertex;
//pnevdev.Local.Basis.oy:=x_Y_zVertex;
//pnevdev.rotate:=0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
unit DEVICE_VEL_POWER_ARK;

interface

uses system,devices;
usescopy blocktype;
usescopy objname_eo;
usescopy objgroup;
usescopy addtocable;
usescopy elreceivers;
usescopy vlocation;
usescopy vinfopersonaluse;

implementation

begin

BTY_TreeCoord:='PLAN_VEL_Электроприемники_Приборы СПС';
Device_Type:=TDT_SilaPotr;
Device_Class:=TDC_Shell;

NMO_BaseName:='ARK';
NMO_Suffix:='';
NMO_Template:='@@[NMO_BaseName]@@[NMO_Suffix]\P@@[Power]';

GC_NameGroupTemplate:='@@[GC_HeadDevice].@@[GC_HDGroup]';

realnamedev:='Приборы СПС';
Power:=0.1;
CosPHI:=0.92;
Voltage:=_AC_220V_50Hz;
Phase:=_A;

INFOPERSONALUSE_TextTemplate:='';

SerialConnection:=1;

end.
Loading

0 comments on commit a8ee169

Please sign in to comment.