mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 17:25:39 +02:00
111 lines
3.4 KiB
ObjectPascal
111 lines
3.4 KiB
ObjectPascal
unit U_SCSEngineTest;
|
|
|
|
interface
|
|
|
|
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, ExtCtrls, PCPanel, PCDrawBox, PCDrawing, PowerCad, StdCtrls, pcMsbar, ComCtrls, ToolWin,
|
|
PCTypesUtils,DrawObjects,Menus, DlgBase, ExtDlgs, PCLayerDlg, OleCtnrs,buttons,
|
|
PCgui,GuiStrings, U_Common_Classes, DrawEngine, U_ESCadClasess;
|
|
|
|
|
|
type
|
|
TSCSEngine = class(TObject)
|
|
FMainForm: TForm;
|
|
constructor Create(aOwner: TObject);
|
|
public
|
|
function GetConnectorImg(aCT: TConnectorType): TFigureGrpMod;
|
|
function GetOrthoLineImg(aCT: TOrthoLineType): TFigureGrpMod;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses U_Common;
|
|
|
|
{ TSCSEngine }
|
|
constructor TSCSEngine.Create(aOwner: TObject);
|
|
begin
|
|
FMainForm := TForm(aOwner);
|
|
end;
|
|
|
|
function TSCSEngine.GetConnectorImg(aCT: TConnectorType): TFigureGrpMod;
|
|
var
|
|
BlockFig: TBlock;
|
|
BitmapFig: TBMPObject;
|
|
BlockFName: string;
|
|
BlockID: integer;
|
|
RectNormal: TRectangle;
|
|
i: integer;
|
|
FF: TFigureGrpMod;
|
|
LayHandle: integer;
|
|
begin
|
|
BlockID := ord(aCT);
|
|
Result := nil;
|
|
GCadForm.CurrentLayer := 2;
|
|
LayHandle := GCadForm.PCad.GetLayerHandle(2);
|
|
Result := TFigureGrpMod.create(LayHandle, GCadForm.PCad);
|
|
if BlockID > 0 then
|
|
begin
|
|
try
|
|
// if BlockID = 1 then
|
|
// begin
|
|
// BlockFName := ExtractFileDir(Application.ExeName) + '\.blk\TempNB.blk';
|
|
// BlockFig := TBlock(GCadForm.PCad.InsertBlockwithFileName(2, BlockFName, -100, -100));
|
|
// for i := 0 to BlockFig.InFigures.Count - 1 do
|
|
// Result.AddFigure(TFigure(BlockFig.InFigures[i]));
|
|
// GCadForm.PCad.Figures.Remove(BlockFig);
|
|
// end;
|
|
// if BlockID = 2 then
|
|
// begin
|
|
// BlockFName := ExtractFileDir(Application.ExeName) + '\.blk\ConnAsDefault.blk';
|
|
// end;
|
|
except
|
|
// BlockFName := ExtractFileDir(Application.ExeName) + '\.blk\WA_Default.blk';
|
|
// BlockFig := TBlock(GCadForm.PCad.InsertBlockwithFileName(2, BlockFName, -100, -100));
|
|
// for i := 0 to BlockFig.InFigures.Count - 1 do
|
|
// result.AddFigure(TFigure(BlockFig.InFigures[i]));
|
|
if BlockFig <> nil then
|
|
GCadForm.PCad.Figures.Remove(BlockFig);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
function TSCSEngine.GetOrthoLineImg(aCT: TOrthoLineType): TFigureGrpMod;
|
|
var
|
|
BlockFig: TBlock;
|
|
BitmapFig: TBMPObject;
|
|
BlockFName: string;
|
|
BlockID: integer;
|
|
RectNormal: TRectangle;
|
|
i: integer;
|
|
FF: TFigureGrpMod;
|
|
LayHandle: integer;
|
|
|
|
begin
|
|
BlockID := ord(aCT);
|
|
Result := nil;
|
|
GCadForm.CurrentLayer := 2;
|
|
LayHandle := GCadForm.PCad.GetLayerHandle(2);
|
|
Result := TFigureGrpMod.create(LayHandle, GCadForm.PCad);
|
|
if BlockID > 0 then
|
|
begin
|
|
try
|
|
// if BlockID = 1 then
|
|
// BlockFName := ExtractFileDir(Application.ExeName) + '\.blk\TempNB.blk';
|
|
// if BlockID = 2 then
|
|
// BlockFName := ExtractFileDir(Application.ExeName) + '\.blk\LineAsDefault.blk';
|
|
// BlockFig := TBlock(GCadForm.PCad.InsertBlockwithFileName(2, BlockFName, -100, -100));
|
|
// result := TFigureGrpMod.create(LayHandle, GCadForm.PCad);
|
|
// for i := 0 to BlockFig.InFigures.Count - 1 do
|
|
// begin
|
|
// result.AddFigure(TFigure(BlockFig.InFigures[i]));
|
|
// end;
|
|
// GCadForm.PCad.Figures.Remove(BlockFig);
|
|
except
|
|
if BlockFig <> nil then
|
|
GCadForm.PCad.Figures.Remove(BlockFig);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
end.
|