Scale stops updating.

Scale stops updating.

Tigerpirro
Advocate Advocate
224 Views
1 Reply
Message 1 of 2

Scale stops updating.

Tigerpirro
Advocate
Advocate

Hi. I have this code that changes language in our drawings. Problem is that it doesent change the scale to the scale variable. It just becomes text. This causes issues if you later change the view scale, since it wont update and keep showing the old number. For exampel it will stay 1 : 10 even if you switch to 1 : 5.

So it goes from this:

1.png

to this:

24.png

 

This is the code I use to change the language, but its mostly the last few lines that handles the scale.

Sub BendAnno(Language) 'Sets bend annotations according to language. Only works from english to set language.
	
	If Language = "SWE" 'Swedish
		sUp = "UPP"
		sDown = "NED"
		oDoc = ThisDoc.Document
		oOriginalSheet = oDoc.ActiveSheet
	
		For Each oSheet In oDoc.Sheets 'loop through sheets
			oSheet.Activate
			
			'loop through bend notes
			For Each oNote In oSheet.DrawingNotes.Bendnotes 
			
				'clear overrides (if any)
				oNote.Hidevalue = False 
				oNote.Text = ""
				
				'check direction and set note
				If oNote.Text.Contains("DOWN") Then		
					oText = Replace(oNote.Text,"DOWN",sDown)
					oNote.Hidevalue = True
					oNote.Text = oText
				End If
				
				If oNote.Text.Contains("UP") Then
					oText = Replace(oNote.Text,"UP", sUp)
					oNote.Hidevalue = True
					oNote.Text = oText
				End If
				
			Next oNote
			
		Next oSheet
		oOriginalSheet.Activate 'return to original sheet
		
	End If

	If Language = "ENG" 'English
		sUp = "UP"
		sDown = "DOWN"
		oDoc = ThisDoc.Document
		oOriginalSheet = oDoc.ActiveSheet
	
		For Each oSheet In oDoc.Sheets 'loop through sheets
			oSheet.Activate
			
			'loop through bend notes
			For Each oNote In oSheet.DrawingNotes.Bendnotes 
			
				'clear overrides (if any)
				oNote.Hidevalue = False 
				oNote.Text = ""
				
				'check direction and set note
				If oNote.Text.Contains("NED") Then		
					oText = Replace(oNote.Text,"NED",sDown)
					oNote.Hidevalue = True
					oNote.Text = oText
				End If
				
				If oNote.Text.Contains("UPP") Then
					oText = Replace(oNote.Text,"UPP", sUp)
					oNote.Hidevalue = True
					oNote.Text = oText
					
				End If
				
			Next oNote
			
		Next oSheet
		oOriginalSheet.Activate 'return to original sheet
		
	End If
	
	'Changing view labels
	For Each oSheet As Sheet In ThisDrawing.Document.Sheets
    For Each oView As DrawingView In oSheet.DrawingViews
	'English
    If oView.ShowLabel And CStr(oView.Label.Text) = "SKALA ( " & oView.ScaleString & " )" And Language = "ENG" Then 
		oView.Label.FormattedText = "SCALE ( " & oView.ScaleString & " )"
		
	'Swedish
	Else If oView.ShowLabel And CStr(oView.Label.Text) = "SCALE ( " & oView.ScaleString & " )" And Language = "SWE" Then 
		oView.Label.FormattedText = "SKALA ( " & oView.ScaleString & " )"
	End If
    Next
Next
	
End Sub

 

Is there some way to adapt this so the scale will keep updating appropriately?

0 Likes
225 Views
1 Reply
Reply (1)
Message 2 of 2

jjstr8
Collaborator
Collaborator

You're setting it to the scale string value, not the property.  Instead of oView.ScaleString, it should be the XML tag "(<DrawingViewScale/>)".  Check the API help for "XML Tags for FormattedText" for some additional information.

0 Likes