Jump to content

Script updates Drawing label style but it does not refresh in drawing. 

Recommended Posts

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.':
			if vs.GetObject('Drawing Label Styles') == []:
				vs.NameObject('Drawing Label Styles')
			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.Symbol('Drawing Label VA - Dwg No. Sht No.',pt,0)
			vs.SetPluginStyle(h,'Drawing Label VA - Dwg No. Sht No.')

vs.ForEachObject(dlupdate, "(INSYMBOL & INVIEWPORT & (PON='Drawing Label2') & (V))")


test.vwx Drawing Label format.vsm

Link to comment

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.

Link to comment

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...