Jump to content
Sign in to follow this  
Pat Stanford

General Notes Information to Worksheet

Recommended Posts

The following script transfers the General Notes information from a General Notes Object to a date stamped worksheet.

It is designed for use on Sheet Layers where it gets both the Sheet Number and Sheet title in VW2010.

This is not a live link, but a static copy of the data. Changes made in the worksheet will not update the General Notes object.

Feel free to use and modify as you see fit. If you make modifications, please post the modified version back here for others to use also.

Procedure GeneralNoteToWorksheet;
{Creates a worksheet showing the contents of the a general notes}
{object on the active layer. The GN must be the first selected obejct}
{This is a one way extraction. Changes made in the worksheet will}
{not update the notes in the GN object.}

{Designed to work on sheet layers, but will work on Design Layers also.}
{On Design Layers the Sheet Title will be blank and the Sheet Number}
{column will contain the layer name.}

{June 30, 2010}
{? 2010, Coviana, Inc - Pat Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}


var
 GN_Hand, PG_Hand, Locus_Hand,Layer_Hand, WSH    :Handle;
 Title, Note, NoteNumber, Sheet, SheetNum        :String;
 N1, N2  , N3  , N4, N5, N6                        :Integer;
 B1, B2                                        :Boolean;
 L1  , L2                                        :LongInt;
 NoteArray :Array[1..255,1..3] of string;


Begin
 B1:=GetType(FSActLayer) = 86;
 B2:=GetName(GetRecord(FSActLayer,NumRecords(FSActLayer)))='General Notes';
 SheetNum := GetLName(ActLayer);
 Sheet := GetObjectVariableString(ActLayer, 159);

 If (B1 and B2) then
   Begin
     GN_Hand:=FSActLayer;
     PG_Hand:=GetCustomObjectProfileGroup(GN_Hand);
     Locus_Hand:=FInGroup(PG_Hand);
     N1:=1;

     {Get Store Information on General Notes in Array}
     While ((Locus_Hand <> Nil) and (N1 < 255)) do
       Begin
         Note:=GetRField(Locus_Hand,'NNA_GeneralNotes','Text');
         Title:=GetRField(Locus_Hand,'NNA_GeneralNotes','__NoteDescrip');
         if Title='' then Title := Copy(Note,1,42);
         NoteNumber:=Num2Str(0,N1);
         NoteArray[N1,1]:=Title;
         NoteArray[N1,2]:=NoteNumber;
         NoteArray[N1,3]:=Note;
         N1:=N1+1;
         Locus_Hand:=NextObj(Locus_Hand);
       End;


     {Create Worksheet}
     WSH:=CreateWS(Concat('General Notes :',Sheet,' ',Date(2,1)),N1+2,5);

     SetWSColumnWidth(WSH,1,1,50);
     SetWSColumnWidth(WSH,2,2,100);
     SetWSCOlumnWidth(WSH,3,3,300);
     SetWSCOlumnWidth(WSH,4,4,50);
     SetWSCOlumnWidth(WSH,5,5,400);

     SetWSCellFormula(WSH,1,1,1,1,Concat('General Notes for Sheet: ',Sheet));

     SetWSCellFormula(WSH,3,1,3,1,'Sht #');
     SetWSCellFormula(WSH,3,2,3,2,'Sht Name');
     SetWSCellFormula(WSH,3,3,3,3,'Title');
     SetWSCellFormula(WSH,3,4,3,4,'Number');
     SetWSCellFormula(WSH,3,5,3,5,'Body');


     {set worksheet cell display properties}
     SetWSCellVertAlignment(WSH,1,1,N1+2,5,1);   {Align Text to top of cell}
     SetWSCellWrapTextFlag(WSH,1,5,N1+2,5,True);  {Wrap the body text column}
     SetWSRowHeight(WSH,1,N1+2,22,True,False);   {Automatically adjust height to fit text}


     {populate the worksheet with all the fields}
     For N2 := 1 to N1 do
       Begin                         
         SetWSCellFormula(WSH,N2+3,1,N2+3,1,SheetNum);   
         SetWSCellFormula(WSH,N2+3,2,N2+3,2,Sheet);      
         SetWSCellFormula(WSH,N2+3,3,N2+3,3,NoteArray[N2,1]);
         SetWSCellFormula(WSH,N2+3,4,N2+3,4,NoteArray[N2,2]);
         SetWSCellFormula(WSH,N2+3,5,N2+3,5,NoteArray[N2,3]);
       End;


     {Get total row height for display window}
     L1:=0;
     GetWSRowColumnCount(WSH, N3, N4);
     For N2:= 1 to N3 do
       Begin
         GetWSRowHeight(WSH,N2,N5);
         L1:=L1+N5;
       End;

     N6:=Min(L1,850)+200+72;    {200 for start point, 72 for menu and formula bar}

     {set window display parameters}
     SetWSPlacement(WSH,200,200,N6,1174);    {1174 = 200 + 900 + 74 for row headers}
     ShowWS(WSH,True);
     SetTopVisibleWS(WSH);

   End

 else AlrtDialog('Selected Object is not a General Note.');

End;



Run(GeneralNoteToWorksheet);

Share this post


Link to post

Hey Pat,

How would I go about listing out the General notes title that is inputed in the OIP instead of the description title?

Share this post


Link to post

You mean the title on the OIP page for the General Note? The one that will be the same for every note?

Change Line 42 from:

Title:=GetRField(Locus_Hand,'NNA_GeneralNotes','__NoteDescrip');

to:

Title:=GetRField(FSActLayer,'General Notes','Header Text');

Share this post


Link to post

Again, thank you.

The reason for that is because I have a couple of notes, each listed on every one of my sheet layers: General notes, operation notes, and prototype notes.

Is there a way to modify this script so that it grabs the information of all the general notes throughout all of my sheet layers?

This would save a ton of time since I need to generate a worksheet with all of my notes to send out to a translator.

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...