The Hamma Posted October 20, 2021 Share Posted October 20, 2021 I have a script that worked great in 2021 but now in 2022 the drawing labels that are updated by the script do not update in the drawing. Any ideas how to get it to refresh. I have tried the obvious refresh, redraw options. """ Imports 'Drawing Label VA - Dwg No. Sht No.' into drawing and replaces other styles with this style 2022 Doesn't refresh plugin. Edit plugin geometry to refresh drawing after running script. David Hamer, 2020 Revised 2021-10-19 """ if vs.GetName('Drawing Label VA - Dwg No. Sht No.') != []: ResourceList, NumItems = vs.BuildResourceList(16, 13, 'Object Styles:Drawing Label') while NumItems != 0: ResourceName = vs.GetNameFromResourceList(ResourceList, NumItems) if ResourceName == 'Drawing Label VA - Dwg No. Sht No.': vs.ImportResourceToCurrentFile(ResourceList,NumItems) if vs.GetObject('Drawing Label Styles') == []: vs.NameObject('Drawing Label Styles') vs.BeginFolder() vs.EndFolder() vs.InsertSymbolInFolder(vs.GetObject('Drawing Label Styles'), vs.GetObject('Drawing Label VA - Dwg No. Sht No.')) NumItems -= 1 def dlupdate(h): if vs.GetPluginStyle(h) != 'Drawing Label VA - Dwg No. Sht No. NTS': if vs.GetPluginStyle(h) != 'Drawing Label VA - Dwg No. Sht No.': #pt= vs.Get2DPt(h,0) #vs.DelObject(h) #vs.Symbol('Drawing Label VA - Dwg No. Sht No.',pt,0) vs.SetPluginStyle(h,'Drawing Label VA - Dwg No. Sht No.') #vs.SetClass(h,'A-ANNO-LABL') vs.ResetObject(h) #vs.ReDrawAll vs.ForEachObject(dlupdate, "(INSYMBOL & INVIEWPORT & (PON='Drawing Label2') & (V))") vs.DSelectAll; test.vwx Drawing Label format.vsm Quote Link to comment
Pat Stanford Posted October 20, 2021 Share Posted October 20, 2021 Many years (maybe decades) ago, I think there was some kind of getview/setview voodoo that we used to force complete redraws. But I can't find it in my brain or my archives. Hopefully one of my external brains ( @MullinRJ, @Sam Jones, @michaelk) is able to pull this up. Quote Link to comment
Sam Jones Posted October 20, 2021 Share Posted October 20, 2021 TMI about my experience with the problem and lack of solution. This has always been frustrating. I have on occasion had to put up an alert during the running of the command telling users to nudge the selected objects up and back down after the command completes in order for the screen redraw to complete. All the evidence, and there is very little of it mainly coming from _c_, points to some problem in the script code, but I have not been able to track it down in my code. Some problem in our code that prevents some object redraws and also prevents refreshing of the OIP, is probably better than the problem being buried in the VW engine. Since I can't find it, I blame VW with my users. BTW, when using handles and parameter values, try to be sure to check for NIL values of the handle. VW usually can handle NIL handle values, but every now and then it will bite you in the ass. Running your final checks in developer mode will catch NIL handle values. 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.