sstanelle Posted February 24, 2021 Share Posted February 24, 2021 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) Quote Link to comment
twk Posted February 25, 2021 Share Posted February 25, 2021 Maybe create a temporary symbol > add all other symbols in there > place on drawing > export as image > delete temporary symbol 1 Quote Link to comment
SVA Architects Posted February 25, 2021 Share Posted February 25, 2021 Can anyone solve this section viewport issue - roof tiles face upside down on one side and correctly on the other. Quote Link to comment
sstanelle Posted February 25, 2021 Author Share Posted February 25, 2021 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 Quote Link to comment
Recommended Posts
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.