NikitaA Posted May 27 Share Posted May 27 I am facing a lot of issues when we have moved from VWs 2021 to VWs 2025 version. - Classes like rotation, non print etc. are now getting sent but earlier they were not send. - I see weird grayish background with images. Can somebody suggest where I can look for Vectorscript changes in 2025 version. Thanks. Quote Link to comment
Pat Stanford Posted May 27 Share Posted May 27 The Function Reference (Both online and offline versions) have both a View By Version and an Obsolete Function section so you can see what was added/removed by version. 1 Quote Link to comment
NikitaA Posted May 27 Author Share Posted May 27 Thanks Pat. Just to confirm my understanding, I have two objects that are on different classes grouped together under "Group" class. One object behaves as expected in terms of opacity but the "Rotation" class applied to it is flowing along with the drawing. You are suggesting me to look at the function reference for opacity or rotation to confirm the difference? Thanks. Quote Link to comment
Pat Stanford Posted May 27 Share Posted May 27 I don't understand the question. Can you post screen shots or a sample file to look at? It sounds like perhaps the class attributes have gotten changed when you upgraded, but impossible to say based on just words. If you are actually scripting, then yes, look at the differences in functions in the Function Reference. If you are not actually scripting but just drawing and seeing the issues, then the Function Reference will not help. 1 Quote Link to comment
NikitaA Posted May 28 Author Share Posted May 28 Ok so the first snippet that I have is: 1) The following code is supposed to take the image with no background but I get a weird black background around it. def ClipWhitespaceFromImage(self, inImageFilename): try: image=Image.open(inImageFilename) image.load() bg = Image.new(image.mode, image.size, image.getpixel((0,0))) diff = ImageChops.difference(image, bg) diff = ImageChops.add(diff, diff, 2.0, -100) bbox = diff.getbbox() if bbox: new_image = image.crop(bbox) new_image.save(inImageFilename) logging.debug("Saved clipped image to " + inImageFilename) except: logging.debug("!!!Exception: In ClipWhitespaceFromImage: " + traceback.format_exc()) return inImageFilename def MakeWhitePixelsNonOpaque(self, inImageFilename): try: start_color = (255, 255, 255, 255) # white new_color = (255, 255, 255, 0) # black img = Image.open(inImageFilename).convert("RGBA") shape_data = numpy.array(img) # Replace start color with new color shape_data[(shape_data == start_color).all(axis = -1)] = new_color # Convert back to image final_image = Image.fromarray(shape_data, mode='RGBA') final_image.save(inImageFilename, "PNG") logging.debug("Saved opacity image to " + inImageFilename) except: logging.debug("!!!Exception: In MakeWhitePixelsNonOpaque: " + traceback.format_exc()) return inImageFilename 2) I have grouped two object under class "Group" - One object is under "Bounding Box - Planogram" class - Other object is under "Bounding Box - Caption" class In 2021, these classes are in the background but now they come on top of the render that gets attached in the placeholder space. Thanks. Quote Link to comment
Pat Stanford Posted May 28 Share Posted May 28 This is all pure Python. The Vectorscript Reference will not help you with this. Nor can I help you. I am an Vectorscript guy not a Python guy. Can you or someone familiar with Vectorworks check and see if the raw Vectorworks drawing is behaving the same in 2025 as it was in 2021? Since your script seem to just be taking screenshots, I don't understand why there would be a difference between the two versions. Also, in VW you should not be able to name a Class 'Group' as that name is taken. I am assuming the name is actually something else and you are just using it as a placeholder for this post. Sorry. Quote Link to comment
Gonda Posted June 1 Share Posted June 1 Not sure about your bounding box issue, but for the background color, take a look at: shape_data[(shape_data == start_color).all(axis = -1)] = new_color you're calling .all on what is a value of either 'True' or 'False' so as a result of the '=='... Also, you're not iterating over the value you're indexing into shape_data[] with... If I'm following, it seems you want to iterate over every item (pixel) in your shape_data array, see if that pixel is RGBA@255, if it is, set it's value to RGB@255,A@0. While I'm not a pything exper for i in range(0,len(shape_data)): if shape_data[i] == (255,255,255,255) then: shape_data[i] = new_color end end Cheers, -gonda Quote Link to comment
NikitaA Posted Saturday at 11:21 PM Author Share Posted Saturday at 11:21 PM Actually I found a solution for this bug on GitHub. Also, Vectorworks 2024 works absolutely fine with minor changes in scripting. We have downgraded to use the older version instead. Thanks. 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.