Trying to make al text in viewlabels black.

Trying to make al text in viewlabels black.

machiel.veldkamp
Collaborator Collaborator
216 Views
1 Reply
Message 1 of 2

Trying to make al text in viewlabels black.

machiel.veldkamp
Collaborator
Collaborator
Sub AllBlack()
	Dim LayerCollection As LayersEnumerator = ThisDoc.Document.StylesManager.Layers
	Dim Layer As Layer


	'Loop through LayerCollection
	For Each Layer In LayerCollection
		Dim aColor As Color = Layer.Color
		aColor.Red = 0
		aColor.Green = 0
		aColor.Blue = 0
		Layer.Color = aColor
	Next

	Dim oTextBoxes As TextBoxes
	Dim oDrawingNotes As DrawingNotes
	Dim oViewLabels As DrawingViews
	
	Dim oStyle As TextStyle

	oDoc = ThisDoc.Document
	Dim sht As Sheet
	For Each sht In oDoc.Sheets
		Dim note As DrawingNote
		Dim oView As DrawingView
		Dim oLabel As DrawingViewLabel 
		For Each oView In sht.DrawingViews
			'MessageBox.Show("This is a Label", "Title")
			Dim oColor As Color = oViewLabels.Color
			oColor.Red = 0
			oColor.Green = 0
			oColor.Blue = 0
			Try
				oView.Label.Color = oColor
			Catch
			End Try
		Next
		For Each note In sht.DrawingNotes
			Try
				note.formattedText = note.Replace(note.formattedText, "<StyleOverride Color = '0,0,0'>" & note.formattedText & "</StyleOverride>")
			Catch
			End Try

			Dim oColor As Color = note.Color
			oColor.Red = 0
			oColor.Green = 0
			oColor.Blue = 0
			Try
				note.Color = oColor
			Catch
			End Try
			
		Next
	Next
	
	
	'oTextBox.FormattedText = "<StyleOverride Color = '0,0,0'>" & "</StyleOverride>"
End Sub

I'm trying to loop through all text on the drawing and I'm having some trouble making the text in the drawingview labels black., 

 

Anyone that sees where I'm wrong? 

 

Thanks 🙂 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
217 Views
1 Reply
Reply (1)
Message 2 of 2

bradeneuropeArthur
Mentor
Mentor
Public Sub main()
Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim c As Sheet
Set c = b.ActiveSheet

Dim d As DrawingView
Set d = c.DrawingViews.Item(1)

Dim f As DrawingViewLabel
Set f = d.Label

Dim oColor As Color
'Set oColor = ThisApplication.TransientObjects.CreateColor(255, 0, 0) 'Red
Set oColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0) 'Black


f.Color = oColor
b.Update
'dim co as
End Sub 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes