Jump to content

Worksheet of symbols within a file


markdd

Recommended Posts

That would be nice if it is possible, it could then be a simple way to list all available symbols in the document instead of just the ones actually used.

Especially for library documents this could be a convenient way to see if there are any missing (or extraneous) symbols compared to e.g. a reference list.

 

The next step could be, if possible through e.g. a script, to mark symbols for deletion in the spreadsheet and then remove them all at once instead of (de)selecting through the purge command. This provided that there is a record you can use to ID e.g. mandatory symbols.

Link to comment

The database portion of a worksheet can only report on objects actually placed in the drawing. Resources that are in the file but not used (the ones you can use the Purge command on) can not be seen by the database.

 

It would be possible to write a script that would create a worksheet listing all (or a subset) of the resources in a file.

 

What exactly are you trying to do? Do you need other information about these resources other than the resource name?

Link to comment

Thanks Pat

 

I am trying to do an audit of my symbol library which has been created over the 12 years I have been a VWX user. The Lighting Symbol Maintenance Command only has a fixed set of parameters it can adjust, but I have extra records attached to some symbols that add default data to the Lighting Instrument OIP. Ultimately, I would like to add fields to the Lighting Symbol Maintenance edit window, and I am sure that might be possible by customising the plugin, but I am uncertain how I should proceed. The Worksheet adea seemed like the next best thing.

 

Any ideas would be welcome

Link to comment

So if this is your library, does that mean it is not a typical working drawing? If that is the case, then I would just insert a copy of each symbol in the drawing so you can access then through the worksheet. You won't be able to modify the symbol definitions directly, but at least you should be able to set it up to see the default data.

 

Back in 2010 I wrote a script that places all of the symbols at the root level of the file onto a layer. I have not tried it in VW2017/18.  I was in discussions back in 2015/16 with @shorter to update it to include the ability to handle symbols in folders.

 

Here it is if you want to try it. If you have problems I will see what I can do to help.

 

Procedure PlaceAllSymbols;
{A script to place one instance of every symbol in the root level of a file}
{Change the Const settings below to get the spacing and paper margins as required}

{Provided with no warranty. Use at your own risk. May cause itching}

{Recommended usage:  Create a new Design Layer. Set the Layer Scale. Run the Script}

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


Const Margin=75mm; {margin from paper edge}
             Spacing=1"; {spacing between symbols}

Type  BBoxArray = STRUCTURE
                     Hand:Handle;
                     BoxX1,BoxY1,BoxX2,BoxY2,InsX1,InsY1,Width,Height,InsOffX,InsOffY:Real;
             END;

Var   H1,H2:Handle;
     BBX1,BBY1,BBX2,BBY2                                     :Real;                          {Bounding Box Top Left/Bottom Right}
     SIX1,SIY1                                                       :Real;                          {Symbol Insertion Point X/Y}

     PageX1,PageY1, PageX2,PageY2            :Real;                          {Page Boundaries}    

     PageWidth,PageTop                                       :Real;                          {Drawing Area Calculated Values}
     NumSyms, SymCount                                       :LongInt;                       {Counts of Symbols and symbols processed}

     TotalCount, RowCount, DrawCount         :LongInt;                       {Counters for processing}

     RowMaxHeight, RowWidth                          :Real;                          {Values for the symbols for the current row}
     ThisSymX, ThisRowY                                              :Real;                          {Insertion Point Values for the current symbol}

     SymArray                                                        :DynArray of BBoxArray;    {Array to hold data on all symbols}

     NextWidth                                                       :Real;                          {Width of the next symbol to see if it fits}


Begin
     {Get General information on the drawing size and calculate area to place symbols}    
     GetDrawingSizeRect(PageX1,PageY1,PageX2,PageY2);

     PageWidth:=PageX2-PageX1-2*Margin;
     PageTop:=PageY1-Margin;



     {Get information on symbols and populate an array with size information on all the symbol definitions}
     NumSyms:=SymDefNum;
     Allocate SymArray[1..NumSyms+10];


     H1:=FSymDef;

{set up array with info on all symbol defs in file}

     SymCount:=1;
         
     While H1 <> Nil do
             Begin
                     SymArray[SymCount].Hand:=H1;
                     GetBBox(H1,BBX1,BBY1,BBX2,BBY2);
                     GetSymLoc(H1,SIX1,SIY1);
                     SymArray[SymCount].BoxX1:=BBX1;
                     SymArray[SymCount].BoxY1:=BBY1;
                     SymArray[SymCount].BoxX2:=BBX2;
                     SymArray[SymCount].BoxY2:=BBY2;
                     SymArray[SymCount].InsX1:=SIX1;
                     SymArray[SymCount].InsY1:=SIY1;
                     SymArray[SymCount].Width:=BBX2-BBX1;
                     SymArray[SymCount].Height:=BBY1-BBY2;
                     SymArray[SymCount].InsOffX:=SIX1-BBX1; {offset from left edge to insertion point}
                     SymArray[SymCount].InsOffY:=SIY1-BBY2; {offset from bottom to insertion point}
                     SymCount:=SymCount+1;
                     H1:=NextSymDef(H1);
             End;


     {Set up counters and start locations}
     TotalCount:=0;
     RowCount:=0;

     ThisRowY:= PageY1-Margin;    

     {Draw all Symbols Row by Row}
     While TotalCount<=SymCount-1 do
             Begin
                     {Calculate Number of Symbols for the row}
                     RowWidth :=0;                         {set current row width to zero}
                     RowMaxHeight:=0;                      {set current row height to zero}
                     RowCount:=0;                          {set number of symbols in the row to zero}

                             Repeat
                                     RowCount:=RowCount+1;  {add one symbol}
                                     RowWidth:=RowWidth+SymArray[TotalCount+RowCount].Width + Spacing;  {add the symbol width to the row width}
                                     NextWidth:=SymArray[TotalCount+RowCount+1].Width; {get the width of the next symbol}
                                     {if the current symbol is the tallest so far set the RowHeight to the current symbol Height}
                                     If SymArray[TotalCount+RowCount].Height > RowMaxHeight then RowMaxHeight := SymArray[TotalCount+RowCount].Height;
                             Until (((RowWidth +NextWidth - Spacing) > PageWidth) or ((TotalCount+RowCount)>NumSyms)); {repeat until the next won't fit}
    
                     {Set starting values to draw from}
                     DrawCount:=1;                                         {Counter of symbols drawn}
                     ThisSymX:=PageX1+Margin;                      {Start the first row symbol at the left margin}
                     ThisRowY:=ThisRowY-RowMaxHeight;      {Set the first row symbol at the correct Y position}
                   
                     {Draw the symbols}
                     Repeat
                             {draw symbol. Calculate insertion point based on proper positioning from bottom left}
                             Symbol(GetSDName(SymArray[TotalCount+DrawCount].Hand),ThisSymX+SymArray[TotalCount+DrawCount].InsOffX,ThisRowY+SymArray[TotalCount+DrawCount].InsOffY,0);                               
                             ThisSymX:=ThisSymX+Spacing+SymArray[TotalCount+DrawCount].Width;   {Set the bottom left X position of next symbol}
                             DrawCount:=DrawCount+1;                               {increment counter}
                     Until ((DrawCount>=RowCount));                        {repeat until entire row drawn}
    
                     ThisRowY:=ThisRowY-Spacing;                           {set Y postion for the next row}

                     TotalCount:=TotalCount+DrawCount-1;           {add number of symbols drawn in the row to the total number drawn}
             end;
End;

Run(PlaceAllSymbols);

 

Link to comment

The script works well on 2018 but as all my symbols are in folders its not going to be much help in this instance. What I was hoping I might be able to do is create a worksheet of the default values for the records attached to symbols and then be able to make some changes from the worksheet itself. Is this not going to be possible as things stand at the moment?

 

Many thanks

 

Mark

Link to comment
  • 3 months later...
On 9/30/2017 at 3:37 AM, markdd said:

The script works well on 2018 but as all my symbols are in folders its not going to be much help in this instance. What I was hoping I might be able to do is create a worksheet of the default values for the records attached to symbols and then be able to make some changes from the worksheet itself. Is this not going to be possible as things stand at the moment?

 

Many thanks

 

Mark

 

@markdd This is exactly what I am hoping to do also. Based on Pat's answer above, it may not be possible though? Curious if you've learned anything new on this?

 

https://forum.vectorworks.net/index.php?/topic/54143-script-to-create-a-plant-legend-out-of-plants-in-resource-manager/&tab=comments#comment-271960

 

Thanks.

Link to comment

Ping me on Wednesday and I will try to make some time to take a look.

 

You can access all of the symbols in the resource manager using a Vectorscript call call BuildResourceList.  From that list you could build a manual worksheet with the information on each symbol. You could then edit that data and use a second script to write it back.

 

But you can't use a simple database row to access symbols that are not placed in the drawing.

Link to comment

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.

×
×
  • Create New...