mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-12 00:45:40 +02:00
1530 lines
66 KiB
ObjectPascal
1530 lines
66 KiB
ObjectPascal
{$A+,B-,C+,D+,E-,F-,G+,H+,I-,J-,K-,L+,M-,N+,O-,P+,Q-,R-,S-,T-,U+,V+,W-,X+,Y+,Z1}
|
||
//{$MINSTACKSIZE $00004000}
|
||
//{$MAXSTACKSIZE $00100000}
|
||
//{$IMAGEBASE $00400000}
|
||
//{$APPTYPE GUI}
|
||
//{$J+}
|
||
|
||
unit U_ELCommon;
|
||
interface
|
||
|
||
uses
|
||
Windows, Forms, StdCtrls, Classes, ComCtrls, Controls, DrawEngine, PCTypesUtils, SysUtils, Dialogs,
|
||
Contnrs, DrawObjects, PCDrawBox, PCDrawing, PowerCad, Graphics, FastStrings, FastStringFuncs, U_Cad, U_ESCadClasess, U_SCSLists, U_SCSComponent,
|
||
U_Common_Classes, ActnList, U_BaseCommon, U_Progress, U_Splash, Math, U_Navigator, Messages, LibJpeg, ClipBrd, ExtCtrls,
|
||
IniFiles, Registry, MiTeC_PsAPI, U_SCSInterfPath, U_Common;
|
||
|
||
|
||
Procedure BuildElectricianChemeList(aAVR_Compon: TSCSComponent; aBoxList: TSCSComponents; aSwitchList, aConnectedList: TList; aCableList: TSCSComponents; aConnectedCablesList: TList);
|
||
Procedure BuildWiringSchemeList;
|
||
|
||
implementation
|
||
uses USCS_Main, Menus, U_main, U_MasterNewList, U_MasterNewListLite, U_AutoTraceType, U_Layers, FPlan,
|
||
U_EndPoints, U_TrunkSCS, U_Constants, U_ChooseDesignBoxParams, U_BaseConstants,
|
||
PCPanel, U_SCSClasses, U_ShieldConfig;
|
||
|
||
Procedure BuildElectricianChemeList(aAVR_Compon: TSCSComponent; aBoxList: TSCSComponents; aSwitchList, aConnectedList: TList; aCableList: TSCSComponents; aConnectedCablesList: TList);
|
||
type CableSection = array of Double;
|
||
|
||
var i, j, k, l, m: integer;
|
||
Line_x1, Line_x2,Line_y1,Line_y2: Double;
|
||
//Phaze_Line, NullLine, GroundLine: TOrthoLine; // 헌佾<ED978C>, 牒裔, 狀蟻...
|
||
Phaze_Line, NullLine, GroundLine, SLine: TLine; // 헌佾<ED978C>, 牒裔, 狀蟻...
|
||
ListParams: TListParams;
|
||
OldGCadForm: TF_Cad;
|
||
|
||
TextFigList: TList;
|
||
|
||
Line_Count: Integer;
|
||
Switches, Connections, UzoList: TSCSComponents;
|
||
ConnectedCompon: TSCSComponent;
|
||
CurrText: TRichText;
|
||
TextList: TStringList;
|
||
IconFigList: TList;
|
||
ParentCatalog: TSCSCatalog;
|
||
ComponFigure: TFigure;
|
||
ComponCad, currCad: TF_Cad;
|
||
ComponList: TSCSList;
|
||
DrawFigureStream: TMemoryStream;
|
||
ComponDrawFigure: TFigureGrpMod;
|
||
ObjImage: TBMPObject;
|
||
Stream: Classes.TStream;
|
||
|
||
DownObjectList, ColObjList: TList;
|
||
LineCounter: Integer;
|
||
ConnectedSwitchCompon: TSCSComponent;
|
||
SwitchNames: TStringList;
|
||
MaxTableHeightArray, MaxTableWidthArray: array of double; //
|
||
|
||
AllChemeFiguresList: TList; // 蓴<> 淸身終, 了 惟桎終<E6A18E> 壯鳥櫛循壯 拯諺<E68BAF>
|
||
|
||
CableSectArray, CopperAmperVals, AllumAmperVals, CopperPowerVals, AllumPowerVals: CableSection;
|
||
ElCounter: TSCSComponent;
|
||
PhazeLinePointFigures: TList;
|
||
CurrColor: TColor;
|
||
|
||
function GetComponNamesCounted(aList: TSCSComponents): TStringList;
|
||
var i: integer;
|
||
CanProceed: Boolean;
|
||
currCount: integer;
|
||
ComponName: string;
|
||
LocalList: TSCSComponents;
|
||
begin
|
||
Result := TStringList.Create;
|
||
if aList <> nil then
|
||
begin
|
||
if aList.Count > 0 then
|
||
begin
|
||
if aList.Count = 1 then
|
||
begin
|
||
Result.Add(aList[0].Name + ' 1' + cMasterCompl_Msg5);
|
||
end
|
||
else
|
||
begin
|
||
LocalList := TSCSComponents.Create(false);
|
||
for i := 0 to aList.Count - 1 do
|
||
LocalList.Add(aList[i]);
|
||
|
||
while LocalList.Count > 0 do
|
||
begin
|
||
currCount := 0;
|
||
ComponName := LocalList[0].Name;
|
||
for i := LocalList.Count - 1 downto 0 do
|
||
begin
|
||
if LocalList[i].Name = ComponName then
|
||
begin
|
||
inc(currCount);
|
||
LocalList.Delete(i);
|
||
end;
|
||
end;
|
||
if currCount > 1 then
|
||
begin
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
if aList[i].Name = ComponName then
|
||
begin
|
||
ComponName := aList[i].ComponentType.NamePlural;
|
||
break;
|
||
end;
|
||
end;
|
||
end;
|
||
Result.Add(ComponName + ' ' + inttostr(currCount) + cMasterCompl_Msg5)
|
||
end;
|
||
LocalList.Free;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
Procedure CountMaxValues(aList: TList);
|
||
var i, j: integer;
|
||
ObjList: tList;
|
||
Fig: TFigure;
|
||
ML, MW: integer;
|
||
MaxWVal, MaxHVal: Double;
|
||
maxx, maxy, minx, miny: Double;
|
||
TableHeightArray, TableWidthArray: array of array of double;
|
||
MaxWidth, MaxHeight: Double;
|
||
begin
|
||
|
||
SetLength(TableHeightArray, 6);
|
||
SetLength(TableWidthArray, 6);
|
||
|
||
SetLength(MaxTableHeightArray, 6); // 述櫛診 魏輦迹 增尊把<E5B08A>
|
||
SetLength(MaxTableWidthArray, aList.Count); // 鋪鳥壯 魏輦謫<EFA698> 增鏑訟魏
|
||
|
||
for i := 0 to 5 do
|
||
SetLength(TableHeightArray[i], aList.Count);
|
||
|
||
for i := 0 to 5 do
|
||
SetLength(TableWidthArray[i], aList.Count);
|
||
|
||
ML := 0;
|
||
MW := 0;
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
ObjList := TList(aList[0]);
|
||
for j := 0 to ObjList.Count - 1 do
|
||
begin
|
||
Fig := TFigure(ObjList[j]);
|
||
if fig is TRichText then
|
||
TRichText(Fig).GetBounds(maxx, maxy, minx, miny)
|
||
else
|
||
if fig is TFigureGrpMod then
|
||
TFigureGrpMod(Fig).GetBounds(maxx, maxy, minx, miny)
|
||
else
|
||
Fig.GetBounds(maxx, maxy, minx, miny);
|
||
|
||
TableHeightArray[j, i] := maxy - miny;
|
||
TableWidthArray[j, i] := maxx - minx;
|
||
end;
|
||
end;
|
||
|
||
// 鋪鳥壯 魏輦謫<EFA698> 增鏑訟魏
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
MaxWidth := TableWidthArray[i, 0];
|
||
for j := 0 to Length(TableWidthArray[i]) - 1 do
|
||
begin
|
||
if CompareValue(MaxWidth, TableWidthArray[j,i]) = -1 then
|
||
MaxWidth := TableWidthArray[j, i];
|
||
end;
|
||
//MaxTableWidthArray[i] := Maxwidth;
|
||
if Maxwidth > 35 then
|
||
MaxTableWidthArray[i] := Maxwidth
|
||
else
|
||
MaxTableWidthArray[i] := 35;
|
||
end;
|
||
|
||
// 述櫛診 魏輦迹 增尊把<E5B08A>
|
||
for j := 0 to 5 do
|
||
begin
|
||
MaxHeight := TableHeightArray[j, 0];
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
if CompareValue(MaxHeight, TableHeightArray[j, i]) = -1 then
|
||
MaxHeight := TableHeightArray[j, i];
|
||
end;
|
||
MaxTableHeightArray[j] := MaxHeight;
|
||
end;
|
||
|
||
SetLength(TableHeightArray, 0);
|
||
SetLength(TableWidthArray, 0);
|
||
end;
|
||
|
||
//Procedure DrawPoint(ax, ay: Double; aColor: TColor);
|
||
function DrawPoint(ax, ay: Double; aColor: TColor): TCircle;
|
||
var Circle: TCircle;
|
||
begin
|
||
// Circle := TCircle.Create(ax, ay, 1, 1, ord(psSolid), aColor, ord(bsClear), clBlack,
|
||
// GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
Circle := TCircle.Create(ax, ay, 1, 1, ord(psSolid), aColor, ord(bsSolid), clBlack,
|
||
GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(Circle), false);
|
||
Result := Circle;
|
||
end;
|
||
|
||
Procedure DrawConnectionLine(ax,ay: Double; aIndex: Integer);
|
||
var i: integer;
|
||
dist: Double;
|
||
isBadCable: Boolean;
|
||
ComponProp: PProperty;
|
||
isCopper: Boolean;
|
||
Text: TRichText;
|
||
CountVal: Double;
|
||
CableSection: double; // 遵特杖<E789B9> 魏悚<E9AD8F>
|
||
Circ: TCircle;
|
||
UserRect: TRectangle;
|
||
CurrSwitch, UZOCompon: TSCScomponent;
|
||
Ellips: TEllipse;
|
||
TraceLength: Double;
|
||
CableCompon: TSCSComponent;
|
||
TraceCatalog: TSCSCatalog;
|
||
TraceFigure: TFigure;
|
||
CableList: TSCSComponents;
|
||
TraceList, TraceCatalogList: TList;
|
||
ComponList: TSCSList;
|
||
CadList: TF_CAD;
|
||
|
||
WareVal: string;
|
||
|
||
function CheckCableSection(aCopper: boolean; aVal: Double): Boolean;
|
||
var i, index: integer;
|
||
TableVal, ComponVal: Double;
|
||
begin
|
||
Result := False;
|
||
index := 0;
|
||
ComponProp := ConnectedSwitchCompon.GetPropertyBySysName(pnWireSection);
|
||
if ComponProp <> nil then
|
||
begin
|
||
ComponVal := StrToFloat_My(ComponProp.Value); //遵特杖<E789B9> 穽荻賊杖魏
|
||
//CableSectArray, CopperAmperVals, AllumAmperVals, CopperPowerVals, AllumPowerVals
|
||
if aCopper then
|
||
begin
|
||
for i := 0 to 10 do
|
||
begin
|
||
index := i;
|
||
if CompareValue(CopperAmperVals[i], aVal) = 1 then
|
||
break;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
for i := 0 to 10 do
|
||
begin
|
||
index := i;
|
||
if CompareValue(AllumAmperVals[i], aVal) = 1 then
|
||
break;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
exit;
|
||
|
||
TableVal := CableSectArray[index]; // 調甑奄狀<E5A584> 遵特杖 穽荻賊杖魏
|
||
if CompareValue(TableVal, ComponVal) = 1 then
|
||
Result := True;
|
||
end;
|
||
|
||
function CalcLineCaptionOne: string;
|
||
var i, j: integer;
|
||
MaxCablesTogetherCount: integer;
|
||
ParentComponent: TSCSComponent;
|
||
ParentComponCablesCount: integer;
|
||
LineText: TRichText;
|
||
LineVal: Double;
|
||
wareS: PProperty;
|
||
begin
|
||
Result := '';
|
||
TraceLength := 0;
|
||
TraceList := TList.create;
|
||
TraceCatalogList := TList.create;
|
||
MaxCablesTogetherCount := 0;
|
||
|
||
CableList := TSCSComponents(aConnectedCablesList[aIndex - 1]);
|
||
//TraceLength
|
||
for i := 0 to CableList.Count - 1 do
|
||
begin
|
||
CableCompon := CableList[i];
|
||
if isCableComponent(CableCompon) then
|
||
begin
|
||
if Result = '' then
|
||
begin
|
||
Result := Result + CableCompon.NameMark;
|
||
WareVal := '';
|
||
WareS := CableCompon.GetPropertyBySysName(pnWireSection);
|
||
if Wares <> nil then
|
||
WareVal := Wares.Value;
|
||
end;
|
||
|
||
TraceCatalog := CableCompon.GetFirstParentCatalog;
|
||
if TraceCatalog <> nil then
|
||
begin
|
||
ComponList := F_ProjMan.GSCSBase.CurrProject.GetListBySCSID(TraceCatalog.ListID);
|
||
if ComponList <> nil then
|
||
begin
|
||
CadList := GetListByID(ComponList.SCSID);
|
||
if CadList <> nil then
|
||
begin
|
||
TraceFigure := GetFigureByID(CadList, TraceCatalog.SCSID);
|
||
if traceFigure <> nil then
|
||
begin
|
||
if TraceFigure is TOrthoLine then
|
||
begin
|
||
TraceLength := TraceLength + TOrthoLine(TraceFigure).LengthCalc;
|
||
|
||
if TraceList.IndexOf(TraceFigure) = -1 then
|
||
TraceList.Add(TraceFigure);
|
||
if TraceCatalogList.IndexOf(TraceCatalog) = -1 then
|
||
TraceCatalogList.Add(TraceCatalog);
|
||
|
||
ParentComponent := CableCompon.GetParentComponent;
|
||
if ParentComponent <> nil then
|
||
begin
|
||
if ParentComponent.ComponentType.SysName = ctsnCableChannel then
|
||
begin
|
||
ParentComponCablesCount := 0;
|
||
for j := 0 to ParentComponent.ChildReferences.Count - 1 do
|
||
begin
|
||
if isCableComponent(ParentComponent.ChildReferences[j]) then
|
||
if ParentComponent.ChildReferences[j].IDNetType = 3 then
|
||
Inc(ParentComponCablesCount);
|
||
end;
|
||
if MaxCablesTogetherCount < ParentComponCablesCount then
|
||
MaxCablesTogetherCount := ParentComponCablesCount;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
// 08/06/2021 -- 破<> <20> 禎埃尿<E59F83> 魏悚<E9AD8F> 前診瞬<E8A8BA>諺 桎蟻惟 茵簇寮荻有 <20> 秧妖<E7A7A7>
|
||
{
|
||
LineText := TRichText(TList(DownObjectList[aIndex])[2]);
|
||
LineVal := StrToFloat_My(LineText.re.Text);
|
||
if LineVal <> 0 then
|
||
Result := Result + ' - ' + FloatTostr(Roundx(TraceLength * LineVal, 2)) + ' 院<>*<2A>'; // 08/06/2021 --
|
||
|
||
LineText := TRichText(TList(DownObjectList[aIndex])[4]);
|
||
LineVal := StrToFloat_My(LineText.re.Text);
|
||
if LineVal <> 0 then
|
||
Result := Result + ' - ' + FloatTostr(Roundx(LineVal, 2)) + ' A';
|
||
}
|
||
Result := Result + ' - ' + FloatTostr(Roundx(TraceLength, 2)) + GetUOMString(GCurrProjUnitOfMeasure);
|
||
end;
|
||
|
||
function CalcLineCaptionTwo: string;
|
||
var i: integer;
|
||
LinePower: Double;
|
||
LineVal: TRichText;
|
||
begin
|
||
Result := '';
|
||
if AIndex <= DownObjectList.Count then
|
||
begin
|
||
LineVal := TRichText(TList(DownObjectList[aIndex])[2]);
|
||
LinePower := StrToFloat_My(LineVal.re.Text);
|
||
if LinePower <> 0 then
|
||
Result := Result + FloatTostr(Roundx(TraceLength * LinePower, 2)) + El_Mess8;
|
||
end;
|
||
if WareVal <> '' then
|
||
Result := Result + ' - ' + WareVal + ' - ';
|
||
|
||
end;
|
||
begin
|
||
currSwitch := nil;
|
||
UZOCompon := nil;
|
||
TraceList := nil;
|
||
TraceCatalogList := nil;
|
||
|
||
if AIndex <= Switches.Count then
|
||
currSwitch := Switches[aIndex - 1];
|
||
if CurrSwitch <> nil then // define Connected UZO
|
||
begin
|
||
for i := 0 to CurrSwitch.JoinedComponents.Count - 1 do
|
||
begin
|
||
if TSCSComponent(CurrSwitch.JoinedComponents[i]).ComponentType.SysName = ctsnUZO then
|
||
begin
|
||
UZOCompon := TSCSComponent(CurrSwitch.JoinedComponents[i]);
|
||
break;
|
||
end;
|
||
end;
|
||
end;
|
||
Dist := ay - GroundLine.ap1.y;
|
||
|
||
DrawPoint(ax, ay, clBlack);
|
||
PhazeLinePointFigures.Add(DrawPoint(ax, Phaze_Line.ap1.y, clBlack));//牒裔
|
||
|
||
SLine := TLine.create(ax, Phaze_Line.ap1.y, ax, GroundLine.ap1.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//愉嚴震<E59AB4>
|
||
{
|
||
SLine := TLine.create(ax - 2, GroundLine.ap1.y + 10, ax + 2, GroundLine.ap1.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((45/180)*PI);
|
||
SLine := TLine.create(ax - 2, GroundLine.ap1.y + 10, ax + 2, GroundLine.ap1.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((-45/180)*PI);
|
||
}
|
||
SLine := TLine.create(ax - 2, GroundLine.ap1.y + 4, ax + 2, GroundLine.ap1.y + 4, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((-45/180)*PI); // 渟釣特簇腸潗
|
||
// 禎埃尿城<EFA6BD> 牒奧
|
||
TextList.Clear;
|
||
TextList.Add('L1'); // 述橓增<E6A993> 桎蟻惟 茵簇寮荻有 魏悚<E9AD8F>
|
||
CurrText := CreateTextObject(ax - 5, GroundLine.ap1.y + 2, TextList, True);
|
||
|
||
|
||
DrawPoint(ax + 5, NullLine.ap1.y, clBlack); // 狀蟻
|
||
//SLine := TLine.create(ax + 5, NullLine.ap1.y, ax + 5, GroundLine.ap1.y + Round(Dist* 0.6), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 5, NullLine.ap1.y, ax + 5, GroundLine.ap1.y + Round(Dist* 0.45), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
// 渟釣特簇腸潗
|
||
SLine := TLine.create(ax + 3, GroundLine.ap1.y + 4, ax + 7, GroundLine.ap1.y + 4, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((-45/180)*PI);
|
||
//桎把<E6A18E> (壯 狀蟻)
|
||
Circ := DrawPoint(ax + 6.5, GroundLine.ap1.y + 2.5, clBlack); //銳佾<E98AB3>
|
||
Circ.Radius := 0.7;
|
||
//Circ.Move(0.5, 0.5);
|
||
if UZOCompon = nil then // 剪尿荻魏 悚<> 覃<> (堯<> 破<>-桎 震檉 怏諦잡桎茵診)
|
||
begin
|
||
//SLine := TLine.create(ax + 5, GroundLine.ap1.y + Round(Dist* 0.6), ax, GroundLine.ap1.y + Round(Dist* 0.7), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 5, GroundLine.ap1.y + Round(Dist* 0.45), ax, GroundLine.ap1.y + Round(Dist* 0.55), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
DrawPoint(ax + 10, GroundLine.ap1.y, clBlack); //銳佾<E98AB3>
|
||
//SLine := TLine.create(ax + 10 , GroundLine.ap1.y, ax + 10 , GroundLine.ap1.y + Round(Dist* 0.6), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 10 , GroundLine.ap1.y, ax + 10 , GroundLine.ap1.y + Round(Dist* 0.45), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(ax + 8, GroundLine.ap1.y + 4, ax + 12, GroundLine.ap1.y + 4, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((-45/180)*PI); // 渟釣特簇腸潗
|
||
//灑惟詢鎚 壯 渟釣特簇外陝猥 銳佾<E98AB3>
|
||
SLine := TLine.create(ax + 11.5, GroundLine.ap1.y + 2, ax + 11.5, GroundLine.ap1.y + 3.2, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
//SLine := TLine.create(ax + 10 , GroundLine.ap1.y + Round(Dist* 0.6), ax, GroundLine.ap1.y + Round(Dist* 0.7), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 10 , GroundLine.ap1.y + Round(Dist* 0.45), ax, GroundLine.ap1.y + Round(Dist* 0.55), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
// 卽了<E58DBD>
|
||
//SLine := TLine.create(ax, ay, ax , GroundLine.ap1.y + Round(Dist* 0.4), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax, ay, ax , GroundLine.ap1.y + Round(Dist* 0.2), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end
|
||
else
|
||
begin
|
||
//SLine := TLine.create(ax + 5, GroundLine.ap1.y + Round(Dist* 0.6), ax, GroundLine.ap1.y + Round(Dist* 0.7), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 5, GroundLine.ap1.y + Round(Dist* 0.45), ax, GroundLine.ap1.y + Round(Dist* 0.55), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
DrawPoint(ax + 10, GroundLine.ap1.y, clBlack); //銳佾<E98AB3>
|
||
//SLine := TLine.create(ax + 10 , GroundLine.ap1.y, ax + 10 , GroundLine.ap1.y + Round(Dist* 0.6), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 10 , GroundLine.ap1.y, ax + 10 , GroundLine.ap1.y + Round(Dist* 0.45), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(ax + 8, GroundLine.ap1.y + 4, ax + 12, GroundLine.ap1.y + 4, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Rotate((-45/180)*PI); // 渟釣特簇腸潗
|
||
//灑惟詢鎚 壯 渟釣特簇外陝猥 銳佾<E98AB3>
|
||
SLine := TLine.create(ax + 11.5, GroundLine.ap1.y + 2, ax + 11.5, GroundLine.ap1.y + 3.2, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
//SLine := TLine.create(ax + 10 , GroundLine.ap1.y + Round(Dist* 0.6), ax, GroundLine.ap1.y + Round(Dist* 0.7), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax + 10 , GroundLine.ap1.y + Round(Dist* 0.45), ax, GroundLine.ap1.y + Round(Dist* 0.55), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
// 竣儼出
|
||
SLine := TLine.create(ax, GroundLine.ap1.y + Round(Dist* 0.2), ax, GroundLine.ap1.y + Round(Dist* 0.2) + 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
// 覃<>
|
||
SLine := TLine.create(ax - 3, GroundLine.ap1.y + Round(Dist* 0.2) + 5, ax, GroundLine.ap1.y + Round(Dist* 0.2) + 15, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
Ellips := TEllipse.create(ax, GroundLine.ap1.y + Round(Dist* 0.2) + 18, 3, 1.5, 0, 2, 0, 0, ord(bsClear), 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(Ellips), false);
|
||
|
||
SLine := TLine.create(ax - 5, GroundLine.ap1.y + Round(Dist* 0.2) + 18, ax - 3, GroundLine.ap1.y + Round(Dist* 0.2) + 18, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(ax - 5, GroundLine.ap1.y + Round(Dist* 0.2) + 18, ax - 5, GroundLine.ap1.y + Round(Dist* 0.2) + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(ax - 5, GroundLine.ap1.y + Round(Dist* 0.2) + 10, ax - 1.8, GroundLine.ap1.y + Round(Dist* 0.2) + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
// 卽了<E58DBD>
|
||
//SLine := TLine.create(ax, ay, ax , GroundLine.ap1.y + Round(Dist* 0.4), 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax, ay, ax , GroundLine.ap1.y + Round(Dist* 0.2) + 15, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
// 禎埃尿城<EFA6BD>
|
||
TextList.Clear;
|
||
//TextList.Add(ConnectedSwitchCompon.GetNameForVisible);
|
||
TextList.Add('QD' + inttostr(UZOLIST.IndexOf(UzoCompon)+ 1));
|
||
CurrText := CreateTextObject(ax - 5, GroundLine.ap1.y + Round(Dist* 0.2) + 10, TextList, True);
|
||
currText.Move(ax - 5.5 - currText.Ap2.x, 0);
|
||
end;
|
||
// 間悚蟻 禎埃尿城<EFA6BD>
|
||
if ConnectedSwitchCompon <> nil then
|
||
begin
|
||
//穽荻儼魏 壯 壯藎滄有 <20> 遵特杖<E789B9> 魏悚<E9AD8F>
|
||
isBadCable := False;
|
||
currColor := clBlack;
|
||
ComponProp := ConnectedSwitchCompon.GetPropertyBySysName(pnAluminium); // 厥荻儼魏 壯 茵鎭鳥贍 魏悚<E9AD8F>(靭縊 - 禎 脹鏑妬杖<E5A6AC>, 贍誼麟杖<EFA7B3> - 嚴泣 裔菴狀 竣迹增脣)
|
||
// 述鎖城<E98E96> 診頌擾<E9A08C> 秧<> 調甑奄<E79491> 壯藎滄孺 壯 魏悚蟻 <20> 裔淳茁溢增<E6BAA2> 剪 憶<> 遵特杖<E789B9>
|
||
if ComponProp = nil then //
|
||
isCopper := True
|
||
else
|
||
if ComponProp.Value = '1' then
|
||
isCopper := False;
|
||
|
||
ComponProp := ConnectedSwitchCompon.GetPropertyBySysName(pnWireSection);
|
||
if ComponProp = nil then
|
||
isBadCable := True; // 張 裔菴狀 遵特杖 穽荻賊杖魏(鍊薏)
|
||
|
||
if not isBadCable then // 穽荻儼嶢<E584BC> 魏悚蟻 壯 壯藎滄有
|
||
begin
|
||
Text := TList(DownObjectList[aIndex])[4];
|
||
CountVal := StrToFloat_My(Text.re.text);
|
||
if CountVal > 0 then
|
||
isBadCable := CheckCableSection(isCopper, CountVal)
|
||
else
|
||
isBadCable := true;
|
||
end;
|
||
if isBadCable then
|
||
currColor := clRed;
|
||
|
||
TextList.Clear;
|
||
//TextList.Add(ConnectedSwitchCompon.NameMark); // 述橓增<E6A993> 桎蟻惟 茵簇寮荻有 魏悚<E9AD8F>
|
||
TextList.Add(CalcLineCaptionOne);
|
||
CurrText := CreateTextObject(ax, ay, TextList, True);
|
||
CurrText.Move(ax - 2 - CurrText.CenterPoint.x , ay - Dist/3 - 3 - currText.CenterPoint.y);
|
||
CurrText.Rotate(-0.5 * PI);
|
||
CurrText.Move(ax - 1 - currText.ap4.x, ay - currText.ap1.y - 3);
|
||
|
||
//if isBadCable then
|
||
//begin
|
||
// CurrText.re.font.Color := clRed;
|
||
// SLine.Color := clRed;
|
||
//end;
|
||
|
||
CurrText.re.font.Color := currColor;
|
||
SLine.Color := currColor;
|
||
|
||
// 秧妖<E7A7A7> 魏悚<E9AD8F>(<28> 桎<> 增典佺<E585B8> 剪 泣杖<E6B3A3>)
|
||
if aConnectedCablesList <> nil then
|
||
begin
|
||
// 08/06/2021 --
|
||
{
|
||
if aIndex <= aConnectedCablesList.Count then
|
||
begin
|
||
TextList.Clear;
|
||
//TextList.Add('L = ' + FloatToStr(Roundx(TraceLength, 2)) + ' ' + GetUOMString(GCurrProjUnitOfMeasure));
|
||
|
||
TextList.Add(CalcLineCaptionTwo);
|
||
CurrText := CreateTextObject(ax, ay, TextList, True);
|
||
CurrText.Move(ax + 2 - CurrText.CenterPoint.x , ay - Dist/3 - 3 - currText.CenterPoint.y);
|
||
CurrText.Rotate(-0.5 * PI);
|
||
CurrText.Move(ax + 1 - currText.ap1.x, ay - currText.ap1.y - 3);
|
||
|
||
if isBadCable then
|
||
CurrText.re.font.Color := clRed;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
//調嗚顥 泣杖<E6B3A3>
|
||
//SLine := TLine.create(ax, GroundLine.ap1.y + Round(Dist* 0.3), ax - 3, GroundLine.ap1.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(ax, GroundLine.ap1.y + Round(Dist* 0.2), ax - 3, GroundLine.ap1.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//午成適 設桎茵診
|
||
UserRect := TRectangle.create(ax - 2.9, GroundLine.ap1.y + Round(Dist* 0.13) - 2, ax - 1.9, GroundLine.ap1.y + Round(Dist* 0.15), 2, ord(psSolid){ord(psDash)}, clBlack, ord(bsClear), clRed, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(UserRect), false);
|
||
UserRect.Rotate((-14.5/180)*PI);
|
||
end;
|
||
end;
|
||
|
||
Procedure DrawElCounter;
|
||
var i: integer;
|
||
PointC: TCircle;
|
||
sLine: tLine;
|
||
BlockStream: TMemoryStream;
|
||
ELCounterDrawFigure: TfigureGrpMod;
|
||
BlockFigure: TBlock;
|
||
Bnd: TDoubleRect;
|
||
delta: Double;
|
||
Rect: TRectangle;
|
||
begin
|
||
if PhazeLinePointFigures.Count > 1 then
|
||
PointC := TCircle(PhazeLinePointFigures[PhazeLinePointFigures.Count - 2])
|
||
else
|
||
PointC := TCircle(PhazeLinePointFigures[0]);
|
||
|
||
DrawPoint(PointC.ap1.x + 10, PointC.ap1.y, clBlack);
|
||
DrawPoint(PointC.ap1.x + 15, PointC.ap1.y + 5, clBlack);
|
||
|
||
SLine := TLine.create(PointC.ap1.x + 10, PointC.ap1.y, PointC.ap1.x + 10, PointC.ap1.y - 30, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Color := clRed;
|
||
|
||
SLine := TLine.create(PointC.ap1.x + 15, PointC.ap1.y + 5, PointC.ap1.x + 15, PointC.ap1.y - 30, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
SLine.Color := clBlue;
|
||
|
||
BlockStream := ElCounter.GetObjectIconBlk;
|
||
|
||
if BlockStream <> nil then
|
||
begin
|
||
if BlockStream.Size > 0 then
|
||
begin
|
||
BlockStream.Position := 0;
|
||
ELCounterDrawFigure := TFigureGrpMod.Create(GCadForm.PCad.GetLayerHandle(0),GCadForm.PCad);
|
||
|
||
BlockFigure := TBlock(GCadForm.PCad.InsertBlockFromStream(2, BlockStream, 0, 0));
|
||
if BlockFigure <> nil then
|
||
begin
|
||
if BlockFigure.Selected then
|
||
BlockFigure.deselect;
|
||
try
|
||
SetLayerHandleForFigureGrp(TFigureGrp(BlockFigure), GCadForm.PCad.GetLayerHandle(0));
|
||
except
|
||
end;
|
||
|
||
Bnd := BlockFigure.GetBoundRect;
|
||
delta := abs(Bnd.Top - Bnd.Bottom) / 2;
|
||
|
||
for i := 0 to BlockFigure.InFigures.Count - 1 do
|
||
begin
|
||
ELCounterDrawFigure.AddFigure(TFigure(BlockFigure.InFigures[i]));
|
||
TFigure(BlockFigure.InFigures[i]).Move(0, delta);
|
||
end;
|
||
GCadForm.PCad.Figures.Remove(BlockFigure);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(ELCounterDrawFigure), false);
|
||
BlockFigure.InFigures.Clear;
|
||
BlockFigure.Free;
|
||
end;
|
||
end;
|
||
Bnd := ELCounterDrawFigure.GetBoundRect;
|
||
Rect := TRectangle.create(Bnd.Left, Bnd.Top, Bnd.Right, Bnd.Bottom, 2, ord(psClear), clWhite, ord(psSolid), clWhite, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
ELCounterDrawFigure.InFigures.Insert(0, rect);
|
||
ELCounterDrawFigure.Move(PointC.ap1.x + 9.5 - ELCounterDrawFigure.Ap1.x, PointC.ap1.y - 5 - ELCounterDrawFigure.Ap3.y);
|
||
end;
|
||
|
||
if BlockStream <> nil then
|
||
BlockStream.free;
|
||
end;
|
||
|
||
Procedure DrawTable;
|
||
var i, j: integer;
|
||
bx, by, sx, sy, xDelta: Double;
|
||
figList: TList;
|
||
MaxHeight, MaxWidth: double;
|
||
Fig: TFIgure;
|
||
SLine: TLine;
|
||
NPoint: TDoublePoint;
|
||
UserRect: TRectangle;
|
||
ComponProper: PProperty;
|
||
//Circ: TCircle;
|
||
|
||
function CheckSwitchAmperage(aIndex: integer): Boolean;
|
||
var ComponProp: PProperty;
|
||
TableVal: Double;
|
||
Text: TRichText;
|
||
SwitchCompon: TSCSComponent;
|
||
begin
|
||
Result := True;
|
||
if aIndex <= Switches.Count then
|
||
begin
|
||
SwitchCompon := Switches[aIndex - 1];
|
||
if SwitchCompon <> nil then
|
||
begin
|
||
ComponProp := SwitchCompon.GetPropertyBySysName(pnNominalA); // 狀麟壯<EFA7B3> 設桎茵診
|
||
if ComponProp <> nil then
|
||
begin
|
||
Text := TList(DownObjectList[aIndex])[4];
|
||
TableVal := StrToFloat_My(Text.re.text);
|
||
if CompareValue(TableVal, StrToFloat_My(ComponProp.Value)) = 1 then
|
||
result := False;
|
||
end
|
||
else
|
||
Result := False;
|
||
end;
|
||
end;
|
||
end;
|
||
begin
|
||
//bx := GCadForm.PCad.WorkWidth/10 + 5;
|
||
//bx := GCadForm.PCad.WorkWidth/10 + 1;
|
||
bx := GCadForm.PCad.WorkWidth/10 - 10;
|
||
//Tolik 21/07/2021 - -
|
||
//sx := FloatInUOM(0.065, umMetr, GCurrProjUnitOfMeasure) * GCadForm.PCad.MapScale * 10;
|
||
//sy := FloatInUOM(0.01, umMetr, GCurrProjUnitOfMeasure) * GCadForm.PCad.MapScale * 10;
|
||
|
||
//sx := FloatInUOM(0.065, umMetr, GCurrProjUnitOfMeasure);// * GCadForm.PCad.MapScale * 10;
|
||
//sy := FloatInUOM(0.01, umMetr, GCurrProjUnitOfMeasure); //* GCadForm.PCad.MapScale * 10;
|
||
|
||
sx := 65;
|
||
sy := 10;
|
||
//
|
||
for i := 0 to DownObjectList.Count - 1 do
|
||
begin
|
||
ConnectedSwitchCompon := nil; // 魏悚蟻 剪 設桎茵診
|
||
if i > 0 then
|
||
begin
|
||
if aCableList.Count >= (i - 1) then
|
||
ConnectedSwitchCompon := aCableList[i - 1];
|
||
end;
|
||
|
||
FigList := TList(DownObjectList[i]);
|
||
//by := 190; //(GCadForm.PCad.WorkHeight/2);
|
||
by := 190;
|
||
|
||
if i = 0 then
|
||
begin
|
||
SLine := TLine.create(bx, by - 3 - MaxTableHeightArray[0], bx + sx, by - 3 - MaxTableHeightArray[0], 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end
|
||
else
|
||
begin
|
||
SLine := TLine.create(bx, by - 3 - MaxTableHeightArray[0], bx + MaxTableWidthArray[i] + 1, by - 3 - MaxTableHeightArray[0], 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end;
|
||
if i = 0 then
|
||
begin
|
||
for j := 0 to FigList.Count - 1 do
|
||
begin
|
||
Fig := TFigure(FigList[j]);
|
||
Fig.Move(bx - Fig.ap4.x + 2, by - Fig.ap4.y);
|
||
SLine := TLine.create(bx, by + 3 , bx + sx, by + 3, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
by := by + MaxTableHeightArray[j] + 5;
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
for j := 0 to FigList.Count - 1 do
|
||
begin
|
||
Fig := TFigure(FigList[j]);
|
||
Fig.Move(bx - Fig.ap4.x + 2, by - Fig.ap4.y);
|
||
SLine := TLine.create(bx, by + 3 , bx + MaxTableWidthArray[i] + 1, by + 3, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
by := by + MaxTableHeightArray[j] + 5;
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end;
|
||
end;
|
||
|
||
if i > 0 then
|
||
begin
|
||
DrawConnectionLine(bx + (MaxTableWidthArray[i])/2 ,190 - 3 - MaxTableHeightArray[0], i);
|
||
// 設桎茵<E6A18E> 禎埃尿城<EFA6BD>
|
||
TextList.Clear;
|
||
//TextList.Add(SwitchNames[i - 1]);
|
||
TextList.Add('QF' + inttostr(i));
|
||
TextList.Add(Switches[i - 1].NameMark);
|
||
ComponProper := Switches[i - 1].GetPropertyBySysName(pnNominalA); // 狀麟壯<EFA7B3> 設桎茵診
|
||
if ComponProper <> nil then
|
||
//TextList.Add(ComponProper.Value + ' A' ); // 嚴泣 裔菴<E8A394> 狀麟壯<EFA7B3> 設桎茵診 -- 哀蓀淳潗 <20> 禎埃尿<E59F83>
|
||
TextList.Add('C' + ComponProper.Value); // 嚴泣 裔菴<E8A394> 狀麟壯<EFA7B3> 設桎茵診 -- 哀蓀淳潗 <20> 禎埃尿<E59F83>
|
||
{
|
||
ComponProper := Switches[i - 1].GetPropertyBySysName(pnNominalA); // 狀麟壯<EFA7B3> 設桎茵診
|
||
if ComponProper <> nil then
|
||
TextList.Add(Switches[i - 1].NameMark + ' ' + ComponProper.Value + ' A' ) // 嚴泣 裔菴<E8A394> 狀麟壯<EFA7B3> 設桎茵診 -- 哀蓀淳潗 <20> 禎埃尿<E59F83>
|
||
else
|
||
TextList.Add(Switches[i - 1].NameMark);
|
||
}
|
||
//CurrText := CreateTextObject(bx + (MaxTableWidthArray[i])/2 - 25, GroundLine.ap1.y + 5, TextList, True);
|
||
CurrText := CreateTextObject(bx + (MaxTableWidthArray[i])/2 - 15, GroundLine.ap1.y + 10, TextList, True);
|
||
CurrText.Move(bx + (MaxTableWidthArray[i])/2 - 3.3 - CurrText.Ap3.x, 0);
|
||
// 穽荻儼嶢<E584BC> 壯藎滄有 壯 櫛剪橓秩軫猥 狀麟壯懿 設桎茵診
|
||
if not CheckSwitchAmperage(i) then
|
||
CurrText.re.font.Color := clRed;
|
||
TextList.Clear;
|
||
end;
|
||
|
||
//bx := bx + MaxTableWidthArray[i] + 10;
|
||
if i = 0 then
|
||
bx := bx + sx - 10
|
||
else
|
||
bx := bx + MaxTableWidthArray[i] + 1;
|
||
|
||
|
||
SLine := TLine.create(bx, 190 - 3 - MaxTableHeightArray[0], bx, by - 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
if i = 0 then
|
||
begin
|
||
//距循<E8B79D>
|
||
SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 20, 190 - 3 - MaxTableHeightArray[0], GCadForm.PCad.WorkWidth/10 - 20, by - 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//厥設<E58EA5>
|
||
SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 10, 190 - 3 - MaxTableHeightArray[0], GCadForm.PCad.WorkWidth/10 - 10, by - 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//쭤悰<ECADA4><E682B0>
|
||
SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 20, 190 - 3 - MaxTableHeightArray[0], GCadForm.PCad.WorkWidth/10 - 10, 190 - 3 - MaxTableHeightArray[0], 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//滑悅<EFA484><E68285>
|
||
//SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 20, by - 6, GCadForm.PCad.WorkWidth/10 - 10, by - 6, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
//SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 20, by - 8, GCadForm.PCad.WorkWidth/10 - 10, by - 8, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
SLine := TLine.create(GCadForm.PCad.WorkWidth/10 - 20, by - 5, GCadForm.PCad.WorkWidth/10 - 10, by - 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
end;
|
||
end;
|
||
//bx := bx + 10;
|
||
bx := bx + 2;
|
||
|
||
// 禎崖設<E5B496>潗 秧妖<E7A7A7>
|
||
if aSwitchList.Count = 1 then // 嚴泣 修鴨<E4BFAE> 桎蟻惟 1 設桎茵<E6A18E> - 前診淳潗 靭增<E99DAD> 秧<> 穽凹佺張柳外陝<E5A496> "銳佾<E98AB3>"
|
||
NPoint.x := bx + 20
|
||
else
|
||
NPoint.x := bx;
|
||
|
||
NPoint.z := 0;
|
||
NPoint.y := Phaze_Line.ap2.y;
|
||
Phaze_Line.ActualPoints[2] := NPoint;
|
||
NPoint.y := NullLine.ap2.y;
|
||
NullLine.ActualPoints[2] := NPoint;
|
||
NPoint.y := GroundLine.ap2.y;
|
||
GroundLine.ActualPoints[2] := NPoint;
|
||
|
||
// 헨壯 剪橓秩軫孼狀增<EFA7BA> 禎蟻吾循鎭<E5BEAA>
|
||
UserRect := TRectangle.create(Phaze_Line.ap1.x - 9, Phaze_Line.ap1.y - 20, Phaze_Line.ap2.x + 5, 160 , 2, ord(psDash), clBlack, ord(bsClear), clRed, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(UserRect), false);
|
||
// 批焉疾前特迭凹, 嚴泣 嚴潗
|
||
if ElCounter <> nil then
|
||
DrawElCounter;
|
||
|
||
//厥凹佺張攸嶢<E694B8> 銳佾<E98AB3> <20> 裔<>e佾孼療
|
||
drawPoint(GroundLine.AP2.x - 4, GroundLine.Ap2.y, clBlack);
|
||
drawPoint(Phaze_Line.ap2.x + 5, GroundLine.Ap2.y + 5, clBlack);
|
||
|
||
SLine := TLine.create(GroundLine.AP2.x - 4, GroundLine.Ap2.y, GroundLine.AP2.x - 4, GroundLine.Ap2.y + 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(GroundLine.AP2.x - 4, GroundLine.Ap2.y + 5, GroundLine.AP2.x + 15, GroundLine.Ap2.y + 5, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(GroundLine.AP2.x + 15 , GroundLine.Ap2.y, GroundLine.AP2.x + 15, GroundLine.Ap2.y + 10, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(GroundLine.AP2.x + 16 , GroundLine.Ap2.y + 2, GroundLine.AP2.x + 16, GroundLine.Ap2.y + 8, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(GroundLine.AP2.x + 17 , GroundLine.Ap2.y + 4, GroundLine.AP2.x + 17, GroundLine.Ap2.y + 6, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
//
|
||
// 橓悰<E6A993><E682B0> 妬增<E5A6AC> 診頌擾<E9A08C>
|
||
bx := GCadForm.PCad.WorkWidth/10 - 20;
|
||
by := 190;
|
||
|
||
sy := 70;
|
||
//sy := FloatInUOM(0.07, umMetr, GCurrProjUnitOfMeasure) * GCadForm.PCad.MapScale * 10;
|
||
|
||
SLine := TLine.create(bx, by, bx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx, by - sy, bx + sx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx, by - sy, bx + sx, by, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx/2, by - sy, bx + sx/2, by - 6, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false); // 膣<> 禎禎乙<E7A68E>
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess9);
|
||
TextList.Add(El_Mess10);
|
||
TextList.Add(El_Mess11);
|
||
TextList.Add(El_Mess12);
|
||
|
||
CurrText := CreateTextObject(bx + 2, by - sy + 2, TextList, true);
|
||
CurrText.Rotate(((-90)/180) * PI, CurrText.CenterPoint);
|
||
CurrText.Move(bx + 16 - CurrText.CenterPoint.x, by - sy/2 - CurrText.CenterPoint.y);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess13);
|
||
TextList.Add(El_Mess14);
|
||
TextList.Add(El_Mess15);
|
||
TextList.Add(El_Mess16);
|
||
|
||
CurrText := CreateTextObject(bx + sx/2 + 2, by - sy + 2, TextList, true);
|
||
CurrText.Rotate(((-90)/180) * PI, CurrText.CenterPoint);
|
||
CurrText.Move(bx + 48 - CurrText.CenterPoint.x, by - sy/2 - CurrText.CenterPoint.y);
|
||
|
||
by := by - sy;
|
||
//sy := FloatInUOM(0.025, umMetr, GCurrProjUnitOfMeasure) * GCadForm.PCad.MapScale * 10;
|
||
sy := 25;
|
||
|
||
SLine := TLine.create(bx, by, bx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx, by - sy, bx + sx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx, by - sy, bx + sx, by, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess17);
|
||
TextList.Add(El_Mess18);
|
||
TextList.Add(El_Mess19);
|
||
TextList.Add(El_Mess20);
|
||
TextList.Add(El_Mess21);
|
||
CurrText := CreateTextObject(bx + 2, by - sy + 2, TextList, true);
|
||
|
||
by := by - sy;
|
||
|
||
SLine := TLine.create(bx, by, bx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx, by - sy, bx + sx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx, by - sy, bx + sx, by, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess22);
|
||
TextList.Add(El_Mess23);
|
||
TextList.Add(El_Mess24);
|
||
TextList.Add(El_Mess25);
|
||
TextList.Add(El_Mess26);
|
||
CurrText := CreateTextObject(bx + 2, by - sy + 2, TextList, true);
|
||
|
||
by := by - sy;
|
||
|
||
SLine := TLine.create(bx, by, bx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx, by - sy, bx + sx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx, by - sy, bx + sx, by, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess17);
|
||
TextList.Add(El_Mess18);
|
||
TextList.Add(El_Mess19);
|
||
TextList.Add(El_Mess20);
|
||
TextList.Add(El_Mess21);
|
||
|
||
//TextList.Add('蹶仲城言<E59F8E> 茵臣嶢裝<E5B6A2>');
|
||
//TextList.Add('(埰疾迹增脣 裔陷帙謫<E5B899>');
|
||
//TextList.Add('剪幽<E589AA>孼<EFBFBD> 堯<> 崖昌猥');
|
||
//TextList.Add('涉檉調執): 狀靭<EFA7BA>; 震<>;');
|
||
//TextList.Add('狀麟壯蟻裝<E89FBB> 桎<>, <20>');
|
||
CurrText := CreateTextObject(bx + 2, by - sy + 2, TextList, true);
|
||
CurrText.width := 60;
|
||
|
||
by := by - sy;
|
||
//sy := FloatInUOM(0.023, umMetr, GCurrProjUnitOfMeasure) * GCadForm.PCad.MapScale * 10;
|
||
sy := 23;
|
||
|
||
SLine := TLine.create(bx, by, bx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx, by - sy, bx + sx, by - sy, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
SLine := TLine.create(bx + sx, by - sy, bx + sx, by, 2, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(SLine), false);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess27);
|
||
CurrText := CreateTextObject(bx + 2, by - sy/2, TextList, true);
|
||
end;
|
||
|
||
function GetNominalAmperage(aSwitchCompon: TSCSComponent): string;
|
||
var ComponProp: PProperty;
|
||
begin
|
||
Result := ' 0 '; // Default Swintch 16 A
|
||
if aSwitchCompon <> nil then
|
||
begin
|
||
ComponProp := aSwitchCompon.GetPropertyBySysName(pnNominalA);
|
||
if ComponProp <> nil then
|
||
Result := ComponProp.Value;
|
||
end;
|
||
end;
|
||
|
||
function GetCountedPower(aList: TSCSComponents): String;
|
||
var i: integer;
|
||
ResPower: Double;
|
||
ComponProp: PProperty;
|
||
begin
|
||
Result := ' 0 ';
|
||
|
||
if aList <> nil then
|
||
begin
|
||
ResPower := 0;
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
ComponProp := aList[i].GetPropertyBySysName(pnMaxPower); // 茵揄夭贍茴<E8B48D> 壯藎滄魏
|
||
if ComponProp = nil then
|
||
ComponProp := aList[i].GetPropertyBySysName(pnPower); // 溢蛤前潗
|
||
|
||
if ComponProp <> nil then
|
||
ResPower := ResPower + StrToFloat_My(ComponProp.Value);
|
||
end;
|
||
if ResPower <> 0 then
|
||
ResPower := RoundUP(ResPower);//RoundX(ResPower, 3);
|
||
|
||
Result := ' ' + FloatTostr(ResPower) + ' ';
|
||
end;
|
||
end;
|
||
|
||
Function GetCountedNominal(aList: TSCSComponents): string;
|
||
var i: integer;
|
||
ResVal, PowerVal: double;
|
||
ComponProp: PProperty;
|
||
begin
|
||
Result := ' 0 ';
|
||
if aList <> nil then
|
||
begin
|
||
ResVal := 0;
|
||
for i := 0 to aList.Count - 1 do
|
||
begin
|
||
ComponProp := aList[i].GetPropertyBySysName(pnMaxPower);
|
||
if ComponProp = nil then
|
||
ComponProp := aList[i].GetPropertyBySysName(pnPower);
|
||
if ComponProp <> nil then
|
||
begin
|
||
ResVal := ResVal + (StrToFloat_My(ComponProp.Value) * 1000)/220;
|
||
end;
|
||
end;
|
||
end;
|
||
if ResVal <> 0 then
|
||
begin
|
||
if aList.Count > 2 then
|
||
ResVal := ResVal * 0.8;
|
||
|
||
ResVal := RoundUP(ResVal);//Roundx(ResVal, 3);
|
||
|
||
Result := ' ' + FloatToStr(ResVal) + ' ';
|
||
end;
|
||
end;
|
||
|
||
Begin
|
||
try
|
||
OldGCadForm := GCadForm;
|
||
ListParams := GetListParamsForNewList;
|
||
|
||
ListParams.Caption := El_Mess28;//cChooseComponType_Mes1;
|
||
|
||
ListParams.Name := ListParams.Caption;
|
||
ListParams.MarkID := 0;
|
||
//ListParams.Settings.ListType := lt_ProjectPlan;
|
||
ListParams.Settings.ListType := lt_ElScheme;
|
||
MakeEditList(meMake, ListParams, False);
|
||
AllChemeFiguresList := TList.Create;
|
||
|
||
//DrawProjectPlan(GCadForm, ComponTypes, cbDivideGroupsByJoinedNetTypes.Checked, cbShowGroupContents.Checked);
|
||
//DisableOptionsForDesignList;
|
||
except
|
||
on e: Exception do;
|
||
end;
|
||
SetLength(CableSectArray, 11);
|
||
SetLength(CopperAmperVals,11);
|
||
SetLength(AllumAmperVals,11);
|
||
SetLength(CopperPowerVals, 11);
|
||
SetLength(AllumPowerVals, 11);
|
||
|
||
// 遵特杖<E789B9> 鍊<> 魏悚<E9AD8F>, 壹2
|
||
CableSectArray[0] := 0.5;
|
||
CableSectArray[1] := 0.75;
|
||
CableSectArray[2] := 1;
|
||
CableSectArray[3] := 1.5;
|
||
CableSectArray[4] := 2;
|
||
CableSectArray[5] := 2.5;
|
||
CableSectArray[6] := 4;
|
||
CableSectArray[7] := 6;
|
||
CableSectArray[8] := 10;
|
||
CableSectArray[9] := 16;
|
||
CableSectArray[10] := 25;
|
||
// 竟縊
|
||
//茁乙 桎魏, <20>
|
||
CopperAmperVals[0] := 11;
|
||
CopperAmperVals[1] := 15;
|
||
CopperAmperVals[2] := 17;
|
||
CopperAmperVals[3] := 23;
|
||
CopperAmperVals[4] := 26;
|
||
CopperAmperVals[5] := 30;
|
||
CopperAmperVals[6] := 41;
|
||
CopperAmperVals[7] := 50;
|
||
CopperAmperVals[8] := 80;
|
||
CopperAmperVals[9] := 100;
|
||
CopperAmperVals[10] := 140;
|
||
// 溢蛤前潗, 院<>
|
||
CopperPowerVals[0] := 2.4;
|
||
CopperPowerVals[1] := 3.3;
|
||
CopperPowerVals[2] := 3.7;
|
||
CopperPowerVals[3] := 5;
|
||
CopperPowerVals[4] := 5.7;
|
||
CopperPowerVals[5] := 6.6;
|
||
CopperPowerVals[6] := 9;
|
||
CopperPowerVals[7] := 11;
|
||
CopperPowerVals[8] := 17;
|
||
CopperPowerVals[9] := 22;
|
||
CopperPowerVals[10] := 30;
|
||
//잼誼麟杖<EFA7B3>
|
||
//茁乙 桎魏, <20>
|
||
AllumAmperVals[0] := 0;
|
||
AllumAmperVals[1] := 0;
|
||
AllumAmperVals[2] := 0;
|
||
AllumAmperVals[3] := 0;
|
||
AllumAmperVals[4] := 21;
|
||
AllumAmperVals[5] := 24;
|
||
AllumAmperVals[6] := 32;
|
||
AllumAmperVals[7] := 39;
|
||
AllumAmperVals[8] := 60;
|
||
AllumAmperVals[9] := 75;
|
||
AllumAmperVals[10] := 100;
|
||
// 溢蛤前潗, 侑<>
|
||
AllumPowerVals[0] := 0;
|
||
AllumPowerVals[1] := 0;
|
||
AllumPowerVals[2] := 0;
|
||
AllumPowerVals[3] := 0;
|
||
AllumPowerVals[4] := 4.6;
|
||
AllumPowerVals[5] := 5.2;
|
||
AllumPowerVals[6] := 7;
|
||
AllumPowerVals[7] := 8.5;
|
||
AllumPowerVals[8] := 13;
|
||
AllumPowerVals[9] := 16;
|
||
AllumPowerVals[10] := 23;
|
||
|
||
UzoList := TSCSComponents.Create(false);
|
||
ElCounter := nil;
|
||
PhazeLinePointFigures := TList.Create;
|
||
|
||
CurrColor := clBlack;
|
||
|
||
// 楫尿適 覃<> <20> 撫叱<E692AB> (<28> 凞焉疾前特迭凹, 嚴泣 嚴潗)
|
||
for i := 0 to aBoxList[0].ChildReferences.Count - 1 do
|
||
begin
|
||
if aBoxList[0].ChildReferences[i].ComponentType.SysName = ctsnUZO then
|
||
UzoList.Add(aBoxList[0].ChildReferences[i])
|
||
else
|
||
begin
|
||
if ElCounter = nil then
|
||
if aBoxList[0].ChildReferences[i].ComponentType.SysName = ctsnElCounter then
|
||
ElCounter := aBoxList[0].ChildReferences[i]; // 渟躁渾 禎檉馴僥<E9A6B4> (禎魏 破<>)
|
||
end;
|
||
end;
|
||
|
||
if GCadForm <> OldGCadForm then
|
||
begin
|
||
Line_x1 := GCadForm.PCad.WorkWidth/10 + 55;
|
||
//Line_y1 := GCadForm.PCad.WorkHeight/2;
|
||
Line_y1 := GCadForm.PCad.WorkHeight/3 - 37 ;
|
||
Line_x2 := GCadForm.PCad.WorkWidth/2;
|
||
{
|
||
Phaze_Line := TOrthoLine.create(Line_x1, Line_y1, 0, Line_x2, Line_y1, 0, 4, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad, False, False);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(Phaze_Line), false);
|
||
|
||
NullLine := TOrthoLine.create(Line_x1, Line_y1 - 20, 0, Line_x2, Line_y1 - 20, 0, 4, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad, False, False);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(NullLine), false);
|
||
|
||
GroundLine := TOrthoLine.create(Line_x1, Line_y1 + 20, 0, Line_x2, Line_y1 + 20, 0, 4, ord(psSolid), clRed, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad, False, False);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(GroundLine), false);
|
||
}
|
||
// Lines Count
|
||
Line_Count := aSwitchList.Count;
|
||
TextList := TStringList.Create;
|
||
|
||
// 牒裔
|
||
Phaze_Line := TLine.create(Line_x1, Line_y1, Line_x2, Line_y1, 3, ord(psSolid), clRed, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(Phaze_Line), false);
|
||
TextList.Clear;
|
||
//TextList.Add('L1 L2 L3');
|
||
TextList.Add('L1'); // 禎魏 破<> 修鴨<E4BFAE> 桎蟻惟 220 <20>
|
||
CurrText := CreateTextObject(Line_x1 + 2, Line_y1 - 4, TextList, true);
|
||
//狀蟻
|
||
NullLine := TLine.create(Line_x1, Line_y1 + 5, Line_x2, Line_y1 + 5, 3, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(NullLine), false);
|
||
TextList.Clear;
|
||
TextList.Add('N');
|
||
CurrText := CreateTextObject(Line_x1 + 2, Line_y1 + 1, TextList, true);
|
||
//銳佾<E98AB3>
|
||
GroundLine := TLine.create(Line_x1, Line_y1 + 10, Line_x2, Line_y1 + 10, 3, ord(psSolid), clBlack, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(GroundLine), false);
|
||
TextList.Clear;
|
||
TextList.Add('PE');
|
||
CurrText := CreateTextObject(Line_x1 + 2, Line_y1 + 6, TextList, true);
|
||
|
||
Line_y1 := Line_y1 + 70;
|
||
|
||
TextFigList := TList.Create;
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess1);
|
||
CurrText := CreateTextObject(Line_x1 - 80, Line_y1 + 80, TextList);
|
||
CurrText.Rotate(((-90)/180) * PI, CurrText.CenterPoint);
|
||
//TextFigList.Add(CurrText);
|
||
|
||
ColObjList := TList.Create;
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess2);
|
||
CurrText := CreateTextObject(Line_x1 - 30, Line_y1 + 10, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess3);
|
||
CurrText := CreateTextObject(Line_x1, Line_y1 + 20, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess4);
|
||
CurrText := CreateTextObject(Line_x1, Line_y1 + 30, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess5);
|
||
CurrText := CreateTextObject(Line_x1, Line_y1 + 40, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess6);
|
||
CurrText := CreateTextObject(Line_x1, Line_y1 + 50, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
TextList.Clear;
|
||
TextList.Add(El_Mess7);
|
||
CurrText := CreateTextObject(Line_x1, Line_y1 + 60, TextList);
|
||
TextFigList.Add(CurrText);
|
||
|
||
DownObjectList := TList.Create;
|
||
DownObjectList.Add(TextFigList);
|
||
|
||
k := 0;
|
||
|
||
SwitchNames := TStringList.Create;
|
||
LineCounter := 0;
|
||
for i := 0 to aSwitchList.Count - 1 do
|
||
begin
|
||
Switches := TSCSComponents(aSwitchList[i]);
|
||
for j := 0 to Switches.Count - 1 do // 잡桎茵<E6A18E>(泣杖<E6B3A3>)
|
||
begin
|
||
SwitchNames.Add(Switches[j].GetNameForVisible);
|
||
ComponDrawFigure := nil;
|
||
Line_x1 := Line_x2;
|
||
Connections := TSCSComponents(aConnectedList[k]);
|
||
ColObjList := TList.Create;
|
||
TextList.Clear;
|
||
inc(LineCounter);
|
||
//禎懿婆潗 昌廛有 禎疾齬嶢言<E5B6A2>
|
||
for l := 0 to Connections.Count - 1 do
|
||
begin
|
||
TextList.Add(Connections[l].NAme);
|
||
if Connections[l].IsLine = biFalse then
|
||
begin
|
||
ParentCatalog := Connections[l].GetFirstParentCatalog;
|
||
if ParentCatalog <> nil then
|
||
begin
|
||
ComponList := Connections[l].GetListOwner;
|
||
if ComponList <> nil then
|
||
begin
|
||
ComponCad := GetListByID(ComponList.SCSID);
|
||
if ComponCad <> nil then
|
||
begin
|
||
ComponFigure := GetFigureByID(ComponCad, ParentCatalog.SCSID);
|
||
if ComponFigure <> nil then
|
||
begin
|
||
if ComponFigure is TConnectorObject then
|
||
if TConnectorObject(ComponFigure).ConnectorType = ct_NB then
|
||
if TConnectorObject(ComponFigure).DrawFigure <> nil then
|
||
begin
|
||
ComponDrawFigure := TFigureGrpMod(TConnectorObject(ComponFigure).DrawFigure.Duplicate);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(ComponDrawFigure), False);
|
||
ColObjList.Add(ComponDrawFigure);
|
||
break;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if ComponDrawFigure = nil then
|
||
ColObjList.Add(Nil); // 嚴泣 張<> 淸身終 剪鳥櫛盾<E6AB9B>
|
||
ConnectedSwitchCompon := nil;
|
||
if aCableList.Count >= k then
|
||
ConnectedSwitchCompon := aCableList[k];
|
||
|
||
// 狀靭<EFA7BA> 泣杖<E6B3A3>
|
||
TextList.Clear;
|
||
TextList.Add(inttostr(LineCounter));
|
||
CurrText := CreateTextObject(1, 1, TextList);
|
||
ColObjList.Add(CurrText);
|
||
// 及甑奄壯<E5A584> 溢蛤前潗, 院<>'
|
||
TextList.Clear;
|
||
|
||
if ParentCatalog <> nil then
|
||
TextList.Add(GetCountedPower(Connections))
|
||
else
|
||
TextList.Add(' 0 ');
|
||
|
||
CurrText := CreateTextObject(1, 1, TextList);
|
||
ColObjList.Add(CurrText);
|
||
// 孔麟壯蟻裝<E89FBB> 桎<>, <20>
|
||
TextList.Clear;
|
||
//TextList.Add(inttostr(LineCounter));
|
||
TextList.Add(GetNominalAmperage(Switches[i]));
|
||
CurrText := CreateTextObject(1, 1, TextList);
|
||
ColObjList.Add(CurrText);
|
||
//及甑奄裝<E5A584> 桎<>, <20>
|
||
TextList.Clear;
|
||
//TextList.Add(inttostr(LineCounter));
|
||
TextList.Add(GetCountedNominal(Connections));
|
||
CurrText := CreateTextObject(1, 1, TextList);
|
||
ColObjList.Add(CurrText);
|
||
// 禎懿婆潗 楫尿適 壯藎滄適
|
||
TextList.Free;
|
||
TextList := GetComponNamesCounted(Connections);
|
||
CurrText := CreateTextObject(1, 1, TextList);
|
||
ColObjList.Add(CurrText);
|
||
inc(k);
|
||
|
||
DownObjectList.Add(ColObjList);
|
||
end;
|
||
end;
|
||
|
||
if DownObjectList.Count > 0 then
|
||
begin
|
||
CountMaxValues(DownObjectList);
|
||
DrawTable;
|
||
end;
|
||
SwitchNames.Free;
|
||
AllChemeFiguresList.Free;
|
||
SetLength(CableSectArray, 0);
|
||
SetLength(CopperAmperVals, 0);
|
||
SetLength(AllumAmperVals, 0);
|
||
SetLength(CopperPowerVals, 0);
|
||
SetLength(AllumPowerVals, 0);
|
||
GCadForm.PCad.Refresh;
|
||
end;
|
||
end;
|
||
|
||
Procedure BuildWiringSchemeList;
|
||
var
|
||
i: integer;
|
||
ListParams: TListParams;
|
||
OldGCadForm: TF_Cad;
|
||
Switches, Connections, UzoList: TSCSComponents;
|
||
ConnectedCompon: TSCSComponent;
|
||
CurrText: TRichText;
|
||
TextList: TStringList;
|
||
IconFigList: TList;
|
||
ParentCatalog: TSCSCatalog;
|
||
ComponFigure: TFigure;
|
||
ComponCad, currCad: TF_Cad;
|
||
ComponList: TSCSList;
|
||
DrawFigureStream: TMemoryStream;
|
||
ComponDrawFigure: TFigureGrpMod;
|
||
ObjImage: TBMPObject;
|
||
Stream: Classes.TStream;
|
||
|
||
ShieldCatalog: TSCSCatalog;
|
||
ShieldCompon: TSCSComponent;
|
||
Uzo_List, AutomatList: TList;
|
||
|
||
Bmp: TBmpObject;
|
||
BmpList: TList;
|
||
start_x: integer;
|
||
FlDir: string;
|
||
LineL, LineP, LineN: TLine;
|
||
MaxHeight: Double;
|
||
Begin
|
||
try
|
||
if GpopupFigure <> nil then
|
||
begin
|
||
ShieldCatalog := nil;
|
||
ShieldCatalog := F_ProjMan.GSCSBase.CurrProject.CurrList.GetCatalogFromReferencesBySCSID(GPopupFigure.Id);
|
||
if ShieldCatalog <> nil then
|
||
begin
|
||
//Shield Compon
|
||
ShieldCompon := nil;
|
||
for i := 0 to ShieldCatalog.ComponentReferences.Count - 1 do
|
||
begin
|
||
if ShieldCatalog.ComponentReferences[i].IsTop then
|
||
begin
|
||
if ShieldCatalog.ComponentReferences[i].ComponentType.SysName = ctsnShield then
|
||
begin
|
||
ShieldCompon := ShieldCatalog.ComponentReferences[i];
|
||
break;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
{ F_ShieldConfig.Memo1.Clear;
|
||
F_ShieldConfig.Memo2.Clear; }
|
||
{ F_ShieldConfig.ListBox1.clear;
|
||
F_ShieldConfig.ListBox2.Clear;}
|
||
F_ShieldConfig.InitForm;
|
||
|
||
if ShieldCompon.ChildReferences.Count > 0 then
|
||
begin
|
||
for i := 0 to ShieldCompon.ChildReferences.Count - 1 do
|
||
begin
|
||
//F_ShieldConfig.Memo1.Lines.Add(ShieldCompon.ChildReferences[i].Name + ' ' + ShieldCompon.ChildReferences[i].NameMark);
|
||
F_ShieldConfig.ListBox1.AddItem(ShieldCompon.ChildReferences[i].Name + ' ' + ShieldCompon.ChildReferences[i].NameMark, nil);
|
||
end;
|
||
end;
|
||
|
||
if F_ShieldConfig.ShowModal = mrOk then
|
||
begin
|
||
//Shield Components
|
||
if ShieldCompon.ChildReferences.Count > 0 then
|
||
begin
|
||
Uzo_List := TList.Create;
|
||
AutomatList := TList.Create;
|
||
for i := 0 to ShieldCompon.ChildReferences.Count - 1 do
|
||
begin
|
||
if ShieldCompon.ChildReferences[i].ComponentType.SysName = ctsnUZO then
|
||
Uzo_List.Add(ShieldCompon.ChildReferences[i])
|
||
else
|
||
if ShieldCompon.ChildReferences[i].ComponentType.SysName = ctsnAutoSwitch then
|
||
AutomatList.Add(ShieldCompon.ChildReferences[i]);
|
||
end;
|
||
end;
|
||
|
||
if ((Uzo_List.Count > 0) or (AutomatList.Count > 0)) then
|
||
begin
|
||
OldGCadForm := GCadForm;
|
||
ListParams := GetListParamsForNewList;
|
||
ListParams.Caption := El_Mess30;
|
||
ListParams.Name := ListParams.Caption;
|
||
ListParams.MarkID := 0;
|
||
ListParams.Settings.ListType := lt_AScheme;
|
||
MakeEditList(meMake, ListParams, False);
|
||
i := 0;
|
||
try
|
||
FlDir := ExtractFileDir(Application.ExeName);
|
||
start_x := 50;
|
||
GLoadImageAsIs := true;
|
||
BmpList := TList.Create;
|
||
MaxHeight := 0;
|
||
//旬賊裝<E8B38A> 設桎茵<E6A18E>
|
||
//凞焉疾前特迭凹
|
||
//
|
||
//覃<>
|
||
for i := 0 to Uzo_List.Count - 1 do
|
||
begin
|
||
Bmp := TBmpObject(GCadForm.PCad.InsertBitmap(0, start_x, 50, FlDir + '\IMG\Electro\Uzo.bmp', false, false, false));
|
||
BmpList.Add(Bmp);
|
||
Bmp.Selected := False;
|
||
start_x := start_x + Round(Bmp.ap2.x - Bmp.ap1.x) + 30;
|
||
MaxHeight := max(MaxHeight, bmp.ap4.y - bmp.ap1.y);
|
||
end;
|
||
//設桎茵執
|
||
for i := 0 to AutomatList.Count - 1 do
|
||
begin
|
||
Bmp := TBmpObject(GCadForm.PCad.InsertBitmap(0, start_x, 50, FlDir + '\IMG\Electro\avt.bmp', false, false, false));
|
||
start_x := start_x + Round(Bmp.ap2.x - Bmp.ap1.x) + 30;
|
||
MaxHeight := max(MaxHeight, bmp.ap4.y);
|
||
BmpList.Add(Bmp);
|
||
Bmp.Selected := False;
|
||
end;
|
||
finally
|
||
GLoadImageAsIs := false;
|
||
end;
|
||
i := 0;
|
||
//醴嚴<EFA6B7> 泣杖<E6B3A3> 鳥櫛循潗
|
||
MaxHeight := MaxHeight + 30;
|
||
Bmp := TBmpObject(BmpList[BmpList.Count - 1]);
|
||
//Line
|
||
LineL := TLine.create(27, 30, Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2), 30, 5, ord(psSolid), clRed, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
//Zero
|
||
LineL := TLine.create(27, 35, 45, 35, 5, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
LineL := TLine.create(45, 35, 45, MaxHeight - 20, 5, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
LineL := TLine.create(45, MaxHeight - 20, Bmp.ap1.x + (Bmp.ap2.x - Bmp.ap1.x)/2 + 3, MaxHeight - 20, 5, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
//Ground
|
||
LineL := TLine.create(27, 40, 40, 40, 5, ord(psSolid), clGreen, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
LineL := TLine.create(40, 40, 40, MaxHeight - 10, 5, ord(psSolid), clGreen, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
LineL := TLine.create(40, MaxHeight - 10, Bmp.ap1.x + (Bmp.ap2.x - Bmp.ap1.x)/2 - 3, MaxHeight - 10, 5, ord(psSolid), clGreen, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
|
||
for i := 0 to BmpList.Count - 1 do
|
||
begin
|
||
Bmp := TBmpObject(BmpList[i]);
|
||
// Line
|
||
LineL := TLine.create(Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2), 30, Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2), Bmp.ap1.y, 5, ord(psSolid), clRed, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
LineL := TLine.create(Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2), Bmp.ap3.y, Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2), Maxheight, 5, ord(psSolid), clRed, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
//Zero
|
||
LineL := TLine.create(Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2) + 3, Bmp.ap3.y + 10, Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2) + 3, Maxheight, 5, ord(psSolid), clBlue, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
//Ground
|
||
LineL := TLine.create(Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2) - 3, Bmp.ap3.y + 20, Bmp.ap2.x - ((Bmp.ap2.x - Bmp.ap1.x)/2) - 3, Maxheight, 5, ord(psSolid), clGreen, 0, GCadForm.PCad.GetLayerHandle(0), mydsNormal, GCadForm.PCad);
|
||
GCadForm.PCad.AddCustomFigure(1, TFigure(LineL), false);
|
||
end;
|
||
TextList := TStringList.Create;
|
||
TextList.Add('L1');
|
||
CurrText := CreateTextObject(23, 28, TextList, True);
|
||
TextList.Clear;
|
||
TextList.Add('P');
|
||
CurrText := CreateTextObject(23, 33, TextList, True);
|
||
TextList.Clear;
|
||
TextList.Add('N');
|
||
CurrText := CreateTextObject(23, 38, TextList, True);
|
||
TextList.Free;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
except
|
||
on e: Exception do;
|
||
end;
|
||
//CurrColor := clBlack;
|
||
GCadForm.PCad.Refresh;
|
||
end;
|
||
End. |