A customer wanted to "make his own simple project generator".The following Pascal code creates a new project, inserts a drawing template and inserts three subdrawings.
var A : IPCsApplication; SubDrawing : IPCsSubDrawing; Page : IPCsPage; Doc : IPCsDocument;const oo_AutoPlace = 4; PathDK = 'C:\PCSELCAD\STANDARD\DATASKABELON\'; PathUK = 'C:\PCSELCAD\STANDARD\DATATEMPLATE\';begin A := CreateOleObject('PCsELautomation.Application') as IPCsApplication; A.Documents.Add('',''); (A as IApp).InsertProject(0, PathDK + 'PCSL1L2L3NA3.PRO', '', 0); Doc := A.ActiveDocument; Page := Doc.Drawing.Pages[0]; SubDrawing := Doc.Drawing.LoadSubDrawing(PathDK + 'PCSMOTOR2_VAR.PRO'); Page.PlaceSubDrawing(SubDrawing, 0, 0,0,0, nil, oo_AutoPlace); Page.PlaceSubDrawing(SubDrawing, 0, 0,0,0, nil, oo_AutoPlace); SubDrawing := Doc.Drawing.LoadSubDrawing(PathDK + 'PCSMOTOR1_VAR.PRO'); Page.PlaceSubDrawing(SubDrawing, 0, 0,0,0, nil, oo_AutoPlace);end;
Please note that this is a COM/OLE sample, and not a PC|SCHEMATIC Automation script that can be used from within PC|SCHEMATIC Automation.