Jump to content
Sign in to follow this  
Robert Anderson

Script to Export Revision Data from Sheet Layers

Recommended Posts

This VectorScript is a prototype that addresses the following topics:

-reading information obtained from record data

-formatting and outputting that data into a text file

The text output can then be used in any number of applications or databases. With minor revisions, this script could be modified to export issue data from the drawing border objects, etc.

PROCEDURE export_revisions;

CONST
errmsg_no_DBs = 'ERROR: There are no Drawing Borders in the drawing to report on.';
putfile_prompt = 'Locate the Drawing Border Revision report:';
putfile_default = 'DB_Revisions';
pio_nm = 'Drawing Border - Universal';
tag1 = 'File name';
tag2 = 'Sheet layer';
tag3 = 'Number';
tag4 = 'Description';
tag5 = 'Date';
tag6 = 'Approval';
tag7 = 'Zone';

VAR
outputfile,fname	:STRING;
cnt_cum	:INTEGER;

PROCEDURE handle_TB(TB_h:HANDLE);
CONST
rev_enabled = 'insertRevBlock';
fmt_nm = 'Revision Data';
fld_pfx_1 = 'Description-';
fld_pfx_2 = 'Date-';
fld_pfx_3 = 'Approved-';
fld_pfx_4 = 'Zone-';

VAR
cnt :INTEGER;
desc,dt,apprvd,zone,lyr_nm,result:STRING;
test : BOOLEAN;

BEGIN
result :=getrfield(TB_h,pio_nm,rev_enabled);
uprstring(result);
IF (result = 'TRUE') THEN 
	BEGIN
	lyr_nm :=  getlname(getlayer(TB_h));
	FOR cnt := 1 TO 50 DO
		BEGIN
		desc := getrfield(TB_h,fmt_nm,concat(fld_pfx_1,num2str(0,cnt)));
		dt := getrfield(TB_h,fmt_nm,concat(fld_pfx_2,num2str(0,cnt)));
		apprvd := getrfield(TB_h,fmt_nm,concat(fld_pfx_3,num2str(0,cnt)));
		zone := getrfield(TB_h,fmt_nm,concat(fld_pfx_4,num2str(0,cnt)));
		test := NOT((desc = '')&(apprvd = '')&(zone = ''));
		IF test THEN
			BEGIN
			cnt_cum := cnt_cum + 1;
			writeln(fname,chr(9),lyr_nm,chr(9),num2str(0,cnt_cum),chr(9),desc,chr(9),dt,chr(9),apprvd,chr(9),zone);
			END;
		END;
	END;
END;

BEGIN
cnt_cum := 0;
IF Count(R IN [pio_nm]) > 0 THEN
BEGIN
fname := GetFName;
putfile(putfile_prompt,putfile_default,outputfile);
writeln(tag1,chr(9),tag2,chr(9),tag3,chr(9),tag4,chr(9),tag5,chr(9),tag6,chr(9),tag7);
ForEachObject(handle_TB,R IN [pio_nm]);
Close(outputfile);
END ELSE alrtdialog(errmsg_no_DBs);
END;

RUN(export_revisions);

Edited by Robert Anderson

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...