Jump to content

sstanelle

Member
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by sstanelle

  1. twk, Thank you very much for your response and for your solution. This worked great! I can't believe that I didn't think of this obvious and simple solution. ūüėĄ Regards, Scott
  2. Hi, I wrote the following Python script that finds the first symbol in the active layer, creates an image from the symbol, and then exports the image to a file. This works very well. However, if I try to do something similar with a group containing multiple symbols, the call to vs.CreateImgFromSymbol returns None. This makes sense to me as the name, vs.CreateImgFromSymbol, would seem to imply a symbol rather than a group containing multiple symbols is required as a parameter. My question is whether it's possible to write a python script to export multiple symbols, either grouped or individually, as a single image file. Based on what others on this forum have suggested, I had started to investigate creating a viewport on the active layer and exporting the viewport as an image, so far to no avail. Before I spend more time on the viewport route, I wanted to get some input on whether a viewport is even a viable solution or if there is some other method of exporting multiple symbols as a image. Many thanks in advance, Scott import os hObj = vs.FInLayer(vs.ActLayer()) if hObj == None: vs.AlrtDialog("hObj is null") else: inSymName = vs.GetSymName(hObj) symWidth = vs.HWidth(hObj) symHeight = vs.HHeight(hObj) vs.AlrtDialog("hObj: " + inSymName + ", Width: " + str(symWidth) + ", Height: " + str(symHeight)) imgObj = vs.CreateImgFromSymbol(inSymName, symHeight * 300.0, symWidth * 300.0, 0, 3, 0) if imgObj == None: vs.AlrtDialog("imgObj is null") else: filePath = os.path.expanduser("~") + os.path.sep + "Downloads" + os.path.sep + inSymName + ".png" vs.ExportImageFile(imgObj, filePath)
  3. Hi, I would like to utilize the CreatePullDownSearch function in VW 2021 in my Python script. The API documentation is currently very limited, and it is unclear to me how to use this function in a dialog layout. Could anyone out there provide me with a simple Python script example regarding how to use this function? I don't understand how to set up the data model for the pull down list. The following code only displays a text box, which I'm assuming is the search field, but I don't see how to define the list of items for the pull down. Essentially I am trying to achieve a search capability over a list of items such that the list is filtered as I type text in the search field. So if there is another way to achieve this, that would be fine too. Ideally I would rather use a list box rather than a pull down. By its name, it would seem that CreatePullDownSearch would only work with a pull down rather than a list of items. def DialogHandler(item, data): return None dialog = vs.CreateLayout("Search", False, "Ok", "Cancel") vs.CreatePullDownSearch(dialog, 1, 50) vs.SetFirstLayoutItem(dialog, 1) if (vs.RunLayoutDialog(dialog, DialogHandler) == 1): pass Thanks, Scott
  4. JBenghiat, Thanks for your reply! I was looking for some Python code that I could include in a script. I initially tried the following but I think I somehow need to associate the item with a drop down list. I'm not sure how to do this. Hence, I was hoping someone could provide an example. def DialogHandler(item, data): return None dialog = vs.CreateLayout("Search", False, "Ok", "Cancel") vs.CreatePullDownSearch(dialog, 1, 50) vs.SetFirstLayoutItem(dialog, 1) if (vs.RunLayoutDialog(dialog, DialogHandler) == 1): pass A related question is whether there is a way to bypass CreatePullDownSearch and to have a text box and a list box where as the user types in the text box, the list is filtered with each key stroke. Thanks for any help! Scott
  5. I would like to utilize the CreatePullDownSearch function in VW 2021. The API documentation is currently very limited, and it is unclear to me how to use this function in a dialog layout. Could anyone out there provide me with a simple Python script example regarding how to use this function? Much appreciated. Thanks, Scott
  6. I am experimenting with the new data tag feature in VW 2019. The current external data tag API seems very limited currently and undocumented. I have a simple rectangle object and a data tag linked to the rectangle. Is there a way to query the rectangle object and get a handle to the data tag that references the rectangle object? The external APIs do not seem to support this. Perhaps a private API exists.

 

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