Hatching will not change color.

Hatching will not change color.

JBEDsol
Collaborator Collaborator
469 Views
5 Replies
Message 1 of 6

Hatching will not change color.

JBEDsol
Collaborator
Collaborator

For a long time I would show cutouts w/ hatching.  Add a sketch, make a hatch, then alter the style/color to red.  For some reason the past few weeks I've noticed I can't do this.  It tends to work sometimes but others not and I've no idea why the color won't change.  Is there a setting or something I need to change?  I even changed the default hatch layer to red and nothing.

 

0 Likes
470 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

You mean this:

 

bradeneuropeArthur_0-1673122654581.png

 

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
Message 3 of 6

JBEDsol
Collaborator
Collaborator
Exactly, however when I update the hatch color to red, nothing changes. I go to my layers and change the hatch layer to red, still nothing.
0 Likes
Message 4 of 6

Bellmer-CAD-Admin
Enthusiast
Enthusiast

Hello Guys,

 

I have a similar issue: I want to Change the Color of a hatch region, that has a certain hatch pattern. For the HatchRigion.Color-Object, we have a Method that calls "SetColor(Red as Byte, Green as Byte, Blue as Byte)" available.

I was happy to found this:
https://forums.autodesk.com/t5/inventor-programming-ilogic/accessing-quot-edit-hatch-pattern-quot-in...

I took it and customized it for my usecase, ended up with this:


(you can ignore the Plasibility Test - which was postiv btw)

	oDDoc = ThisDrawing.Document
	oSheet = oDDoc.ActiveSheet
	For Each oView As DrawingView In oSheet.DrawingViews
		If oView.ViewType = DrawingViewTypeEnum.kSectionDrawingViewType Then
			Dim oSView As SectionDrawingView = oView
			For Each oHatchR As DrawingViewHatchRegion In oSView.HatchRegions
				'check pattern type for concrete
				If oHatchR.Pattern.Name = "AR-CONC"
					oHatchR.Color.SetColor(192, 192, 192)
					
'					' Plausibility test for access to the HatchRegion-Object:
'					If oHatchR.DoublePattern = True
'						oHatchR.DoublePattern = False
'					Else
'						oHatchR.DoublePattern = True
'					End If
					
				End If
			Next
		End If
	Next

 
My Problem: the SetColor-Method does nothing...

Doing the job manually is like:

BellmerCADAdmin_0-1742561884932.png

 



What did I do wrong? Do I have to assign sth like a Color-Object to oHatchR.Color, to overwrite it, instead of just giving the RGB-Values?
(I am working with Inventor 2023.5.2)

Thanks for your help so much in advance
BR Raphael


0 Likes
Message 5 of 6

Ivan_Sinicyn
Advocate
Advocate

@Bellmer-CAD-Admin 

Sub Main()
    ' Get the active drawing document
    Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
    If oDDoc Is Nothing OrElse oDDoc.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
        Exit Sub
    End If

    ' Get the active sheet
    Dim oSheet As Sheet = oDDoc.ActiveSheet
    
    ' Iterate through all views on the sheet
    For Each oView As DrawingView In oSheet.DrawingViews
        If oView.ViewType = DrawingViewTypeEnum.kSectionDrawingViewType Then
            Dim oSView As SectionDrawingView = oView
            ' Iterate through hatch regions in the section view
            For Each oHatchR As DrawingViewHatchRegion In oSView.HatchRegions
                ' Check pattern type for concrete
                If oHatchR.Pattern.Name = "AR-CONC" Then
                    ' Create a new color object and assign it
                    Dim oColor As Color = ThisApplication.TransientObjects.CreateColor(192, 192, 192)
                    oHatchR.Color = oColor
                End If
            Next
        End If
    Next
End Sub
INV 2025.3
Message 6 of 6

Bellmer-CAD-Admin
Enthusiast
Enthusiast

Hi Ivan,

 

thanks a lot! Works perfekt!

BR

Raphael

0 Likes