Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Convert Program Posted by tellm on 30 Jan 2013 at 8:26 AM
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

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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.