Hi. I have some code which creates a DXF of the files I have. however, the question is can the code be adapted to print an individual PDF of each of the files rather than create a DXF?
Thanks
[code]unit DXF_SAVER;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure OpenDialog1CanClose(Sender: TObject; var CanClose: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
PD : TData ;
PN : TSNPart ;
i,j : integer ;
Collection : TSNCollection;
ab,s,ss,px : string;
dxfpath,tempname : string;
IniFile : TIniFile;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
begin
Form1.caption := ('DXF Saver 1.0');
label2.caption := ('DXF out path:');
Button1.caption := ('Create DXF Files');
IniFile := TIniFile.create(SystemPath+'Dxf Saver.ini');
edit1.text :=IncludeTrailingBackSlash(IniFile.ReadString('GENERAL','DXF_PATH',''));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
//Test for empty workspace and exit gracefully.
if (Datalist.count-1 < 0) then begin
label1.caption:= ('Error, No Parts on WS.');
exit;
end; // if (Datalist.count-1 <= 0) then begin
//Process Parts on Workspace
for i := 0 to DataList.count-1 do begin
screen.cursor:=crhourglass;
button1.enabled := false;
PD := DataList.at_Object(i);
if IsSNPart(PD) then begin //Test for valid parts.
PN := DataList.at_Object(i) ;
If PN.Revno = '' then begin
PN.Revno := '#';
end;
dxfpath:= IncludeTrailingBackSlash(edit1.text);
tempname := PN.Partname;
PN.Partname := (PN.Partname);
DoBatchString(nil,DataList,'EXPORT,PART,'+ PN.Partname +',DXF,' + dxfpath) ;
PN.Partname := tempname;
end;//if IsSNPart(PD) then begin
end;// for i := 0 to DataList.count-1 do begin
screen.cursor:=crdefault;
IniFile := TIniFile.create(SystemPath+'Dxf Saver.ini');
Inifile.WriteString('GENERAL','DXF_PATH', + dxfpath) ;
button1.enabled := true;
label1.caption := ('Completed');
end;
Collection.Free ;
end.[/code]