Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
J-Camper
in reply to: WCrihfield

@WCrihfield,

 

I was able to put this together:

Private Function BuildHatchMap(StyleName As String) As NameValueMap
	Dim OutputMap As NameValueMap = g_inventorApplication.TransientObjects.CreateNameValueMap()

	Dim DesignDateFolder As String = g_inventorApplication.DesignProjectManager.ActiveDesignProject.DesignDataPath
	Dim StandardXMLFullFileName As String = DesignDateFolder & "standard.xml"
	Dim GenericStyleHeading As String = "Style"
	Dim HatchMapHeading As String = "HatchMaterialMap"
	Dim MaterialAttribute As String = "Material"
	Dim PatternHeading As String = "PatternLine"

	Dim StandardXMLdoc As XDocument = XDocument.Load(StandardXMLFullFileName)


	Dim styleElement As XElement

	For Each s As XElement In StandardXMLdoc.Descendants(GenericStyleHeading)

		If s.Value.Contains(StyleName) Then styleElement = s : Exit For

	Next

	If styleElement.Value Is String.Empty Then Return Nothing

	Dim HatchMapXElement As XElement = styleElement.Descendants(HatchMapHeading)(0)

	If HatchMapXElement.Value Is String.Empty Then Return Nothing

	'Now We need to parse this for Materials

	For Each s As XElement In HatchMapXElement.Elements()

		Dim MaterialName As String = s.Attribute(MaterialAttribute).Value

		Dim PatternLine0 As String = s.Descendants(PatternHeading)(0).Value.Split(",")(0)

		PatternLine0 = Right(PatternLine0, PatternLine0.Length - 1)

		OutputMap.Add(MaterialName, PatternLine0)

	Next

	Return OutputMap
End Function

 

It builds a namevaluemap for the StyleStandard name provided.  I was feeding from Main:

dDoc.StylesManager.ActiveStandardStyle.Name

 

I'm wondering if anyone has a more elegant solution.