Jump to content

Pat Stanford

Moderator
  • Posts

    12,530
  • Joined

  • Last visited

Posts posted by Pat Stanford

  1. And a note on the above.  If the cells you are trying to reference are in database subrows, the above will not work as you can't directly access a subrow because they are "dynamic" and the sort order (and the cell reference) could change based on adding or removing objects from the drawing.

     

    If you have to use a database, it might be possible to use a Worksheet Script to locate and access the data, but the script would have to live in every file you want to have the funcationality in or be stored in your user / workgroup folder and updated every time you upgrade VW.

  2. If you are using Worksheet Cells then you can use a #WS_ function to return a cell value into a data tag.

     

    #WS_Concat('Worksheet-1':A1)#

     

    I used Concat because it will grab the text from the cell and display it as text even though it is only a single value.

     

    If your output is numbers and you need to have specific formatting, you might be better off using the TXT function instead as it provides options for setting unit and data formatting.

     

    Enclose the worksheet name in single quotes and then follow that with a colon and the Cell Reference not in quotes.

     

    Worksheet function reference here:  https://developer.vectorworks.net/index.php?title=Worksheet_Functions#General

     

    • Like 1
  3. For the rotation, I think you will have to edit the symbols and rotate the objects in them to be horizontal in the definition. Which means that you will have to edit every place you use them in your drawing.

     

    For size, you can select the database header row cell and edit the Cell formation for Image. Best option will probably be fixed size, but that will make your different length poles all show the same. Maybe you want to use the Layer Scale or a Fixed Scale, but I you have objects that are very different sizes in the drawing then some of them will probably appear too large or too small.

     

    The image functions work best with objects that are all of similar sizes.

     

    image.png.f97fdb8b40b85a6964b24be9596f10e4.png

  4. There are a number of WS Functions that you can't pass criteria to in Spreadsheet cells.  RunScript and standard Record.Field are the two most obvious and ones that could be made more useful by having a way to pass criteria.  

     

    And I think the ObjectData - 'Universal Value' kind of supports criteria for Record.Field but as we said in the other thread, it is currently hindered by not handling compound criteria.

     

    Maybe Someday.

    • Like 1
  5. A Database SubRow (unless it is SUMmarized) and a Data Tag both return a reference to a single specific object.

     

    In this case of the Data Tag, that reference is to a Worksheet Image. Once you have the handle to the Image you can get the Handle and then the name of  the parent Worksheet object.

     

    In a Database subrow, since the objects returned (except for the special case below) are not Worksheet Images, there is no way for a script to know what environment it is running from. So a worksheet script can't say "I'm running inside of Worksheet XYZ" (actually it could, but it does not do that now). So since you can't get the handle to the worksheet, you can't get the name of the worksheet either.

     

    The special case would be a worksheet which had a database row with a criteria of Object Type is Worksheet Image. In that case you could probably get the Worksheet name for each image.  And maybe you could do some trickery in the criteria to only return a single Worksheet Image that happened to be an image of the worksheet producing the image and be able to get the worksheet name. But as I was once told:

     

    Quote

    "What you are trying to do sounds fancy, and as such it sounds like it won't work.”

    Vlado Stanev, VW SDK List Dec. 4, 2015

     

    If you want to play be my guest.  Create a worksheet with a database row returning Worksheet Images and see what it would take to get the criteria set to only show a single image. You could then use a =RunScript('WSNameToTag') script from above to return the actual worksheet name from the resource manager.

     

    I think the effort to define the criteria would be much harder than just typing in the name.  But maybe if you only had one worksheet on each layer and could use just a layer criteria it might work,

     

    Good Luck.

  6. Database rows can be sorted by any column by clicking the disclosure triangle in the database header row for that column and choosing Ascending or Desending.  You can sort by Multiple Columns, but you may have to remove the sort and replace them if you want to change the sort priority.

     

    There is no sort capability for Spreadsheet rows.

  7. Yes. The worksheet has no way of knowing what its name is.  In this case, since you can't Data Tag a worksheet, but only a Worksheet Image, I use that to our advantage.

     

    I can get a handle to the worksheet from the worksheet image and then get the name of that worksheet.

     

    The Data Tag just happens to be able to use the WSScript_GetObject and WSScript_SetRetStr functions to do the I/O and find out the tagged object.

    • Like 1
  8. Copy the single line below and paste it into a blank Vectorscript named WSNameToTag

    WSScript_SetResStr(GetName(GetWSFromImage(WSScript_GetObject)));

     

    Once you have the script created, edit your tag to include the following line:

     

    #WS_RUNSCRIPT('WSNameToTag')#

     

    All of the punctuation is critical. Just copy and paste and it should work.  The script will have to be included in every file that you want to use the Data Tag in.

     

    HTH

    • Like 1
  9. Maybe things have changes I did have not noticed.  I learned about the hard code long ago before almost everyone had a mouse with s scroll wheel for zoom.

     

    I think that originally the Z and X keys were configured for zoom. And then those were needed some something else and 1 & 2 were added.

     

    But I just realized this weekend I have been using VW (Minicad) for 33 years (1991 MiniCad 3+). So there are a lot of things that I "know" that are no longer true. 😉

     

    • Laugh 1
  10. From a strictly algebraic viewpoint,  1 Meter = 1000 mm, so if you enter D in MM you need to divide it by 1000 to get meters.   So the following should get you the SRZ in meters while allowing you to enter D in mm.

     

    SRZ radius = ((D / 1000) × 50) to the power of 0.42 × 0.64  

     

    If you want the SRZ to be reported in mm, as well as entering D in mm then you will need:

     

    SRZ radius = (((D / 1000) × 50) to the power of 0.42 × 0.64) * 1000

     

     

  11. I hope I am wrong and someone will correct me, but I don't believe there is a way to generate a text string inside a worksheet and have it converted to a formula. This is one of the things that makes working with Revision and Issue records difficult.

     

    You could use a Vectortscript/Python Script to read the data from those cells and generate the formula in the desired cell, but I think the user interface would be challenging.

     

    I think the best solution would be a worksheet script.

  12. Sorry for the delay. Crazy week.

     

    Worksheet Function Documentation is available here:  https://developer.vectorworks.net/index.php?title=Worksheet_Functions#General_2

     

    What the original poster was looking for (or kind of looking for) is a way to generate a display of Feet & Inches from a dimension in millimeters.  The worksheet TXT function will generate a string representation of a dimension conversion. It will be a string and not a number, so you can't use it in calculations.

     

    In a document with Dimensions set to millimeters, and a dimension value stored in cell A3, this function will return a string showing the feet and inches value with fractional inches rounded to the nearest 1/16th of an inch.

     

    =TXT(A3, 'FeetNInches', 'Frac', '1/16')

     

     

    If you are in a country that used the comma as the decimal point in numbers you will need to use semicolons [;] to separate the function parameters instead of the commas I have shown.

     

    HTH.  Ask if you need more help.

    • Like 2
  13. Is it possibly shifting between your printer for printer setup and Any Printer?  


    Any Printer typically has larger margins than specific printers therefore a smaller print area.

  14. You are trying to use the Database criteria in the worksheet cell instead of in the database header.

     

    Right click on the Row header (I usually start at Row 3 because it is easier to add extra lines above later when I figure out what titles I need).

    Choose Database from the popup menu.

    image.png.3e5959a1714e72ab15c3874ed748fcaf.png

     

    This will open the Criteria Builder 

    image.png.0f79cb896be6b5ab4e9d2b287dbd839f.png

     

    When you click OK on the criteria builder, the Database function will be automatically created.

     

    To edit later, right click on the database row header and choose Edit Criteria.

     

    Or if you want to manually adjust the criteria choose the Edit Database Formula and the database formula will appear in the formula edit bar so you can change it.

     

    Sorry that I didn't pick up on your putting the database in the wrong place on your first post.

    • Like 1
×
×
  • Create New...