Change Model Colors

Change Model Colors

b.tuckerB6DT3
Explorer Explorer
971 Views
1 Reply
Message 1 of 2

Change Model Colors

b.tuckerB6DT3
Explorer
Explorer

Hello, I am currently trying to make an external rule to change the color scheme of a drawing so I can effectively have a "dark mode" to use while I'm working, but then am able to change it back to the default colors when I'm done. I've found how to change balloons, text, and dimensions, but am struggling to find a way to change the color of model lines in drawing views. Currently this is what I have:

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oSheetSettings As SheetSettings
oSheetSettings = oDoc.SheetSettings

Dim oColor As Color
'oColor = ThisApplication.TransientObjects.CreateColor(237, 237, 214)
oColor = ThisApplication.TransientObjects.CreateColor(50, 50, 50)

Dim oDim As DrawingDimension
oDim = oDoc.ActiveSheet.DrawingDimensions.Item(1)

oSheetSettings.SheetColor = oColor
'oColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
oColor = ThisApplication.TransientObjects.CreateColor(255, 255, 255)
oDim.Text.Color = oColor
oDim.Layer.Color = oColor

Dim oNewLayer As Layer
oNewLayer = oDoc.StylesManager.Layers.Item(1)
oNewLayer.LineType = LineTypeEnum.kContinuousLineType
oNewLayer.Color = oColor

Dim oStyles As DrawingStylesManager
oStyles = oDoc.StylesManager

Dim oSheet As Sheet
Dim oBalloon As Balloon
For Each oSheet In oDoc.Sheets 
	'change ballons
	For Each oBalloon In oSheet.Balloons
		'oBalloon.Style = oStyles.BalloonStyles.Item("DC-STD_Balloon")
		oBalloon.Layer.Color = oColor
	Next
	
' Iterate over all dimensions in the drawing and change style
For Each oDim In oSheet.DrawingDimensions
	'oDrawingDim.Style = oStyles.DimensionStyle.Item("DC-STD_Dim")
	oDim.Layer.Color = oColor
    Next
Next

 

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

dalton98
Collaborator
Collaborator

You could change the color of each drawing curve in the Drawing View/ model. Here is an example:

Dim oColor As Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oView As DrawingView
For Each oView In oSheet.DrawingViews
	Dim oCurve As DrawingCurve
	For Each oCurve In oView.DrawingCurves
		'nothing to return to normal
		oCurve.Color = Nothing
		'change color
		oCurve.Color = oColor
	Next
Next
0 Likes