Stedonbouw Posted February 2 Share Posted February 2 import vs NIEUW_SYMBOOL = "boom test symbool" # <-- jouw doelsymbool def is_dxf_symbool(naam): return ( naam == "DXF point" or naam.startswith("symbolLayer") ) def verwerk_object(h): # 1. Kenmerken Door Klasse vs.SetPenColorByClass(h) vs.SetLWByClass(h) vs.SetLSByClass(h) vs.SetFillColorByClass(h) vs.SetFPatByClass(h) # 2. Alleen symbol-instances if vs.GetTypeN(h) == 15: # symbol instance sym_naam = vs.GetSymName(h) if is_dxf_symbool(sym_naam): x, y = vs.GetSymLoc(h) rot = vs.GetSymRot(h) sx = vs.GetObjectVariableReal(h, 102) # schaal X sy = vs.GetObjectVariableReal(h, 103) # schaal Y klasse = vs.GetClass(h) laag = vs.GetLayer(h) vs.DelObject(h) nieuw = vs.Symbol(NIEUW_SYMBOOL, x, y) # correcte Python-manier vs.SetObjectVariableReal(nieuw, 1001, rot) vs.SetObjectVariableReal(nieuw, 102, sx) vs.SetObjectVariableReal(nieuw, 103, sy) vs.SetClass(nieuw, klasse) vs.SetLayer(nieuw, laag) def main(): vs.ForEachObject(verwerk_object, "ALL") vs.AlrtDialog( "Klaar: DXF point + symbolLayer-symbolen vervangen en alles Door Klasse gezet." ) main() Hello fellow forum users, With a lot of help from ChatGPT, i have 'made' this script. My programming knowledge is not zero but it is very limited. So far this script does exactly what i would like it to do. Although when running the script, I get the error message in the image. No suprise Chatgpt or Copilot have no clue why it is happening. What is going wrong? Quote Link to comment
Letti R Posted February 3 Share Posted February 3 Hello, ChatGPT and other LLMs sometimes use vs. Functions that dont exist. For example vs.SetLayer to my knowledge does Not exist. Use vs.SetParent instead. (Second Error) The other Error is in the use of vs.Symbol. this function needs the name, the insertion coordinates an the insertion angle. You dont provide the angle. Please search for the functions in the vwx function reference for more information. Regards, Letti 2 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.