Hatch Pattern By Material

Hatch Pattern By Material

kresh.bell
Collaborator Collaborator
568 Views
3 Replies
Message 1 of 4

Hatch Pattern By Material

kresh.bell
Collaborator
Collaborator

Hi,

is it possible to create an iLogic that would activate the "By Material" option for all Hatch Patterns, for all sheets?

 

Screenshot 2021-11-05 085352.jpg

0 Likes
Accepted solutions (1)
569 Views
3 Replies
Replies (3)
Message 2 of 4

theo.bot
Collaborator
Collaborator

Yes you can. But you can only set this option when the material is defined in the Standard Style. When you change the material of a component to a material that is not listed, then automaticly this value is set to false and is't not available for selection.

theobot_0-1636104510695.png

here is a small sample:

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document 

Dim oSheet As Sheet
Dim oView As DrawingView
Dim oHatchRegion As DrawingViewHatchRegion

For Each Sheet In oDoc.Sheets
	For Each oView In oDoc.ActiveSheet.DrawingViews
		If Not oView.HatchRegions Is Nothing Then
			For Each oHatchRegion In oView.HatchRegions
				
				'Set ByMaterial
				Try
				oHatchRegion.ByMaterial = True
				Logger.Info(oView.Name & ": HatechRegion.ByMaterial = " & oHatchRegion.ByMaterial)
				Catch
				MessageBox.Show("The Material of the sectioned component is not in Style definition, please add the material before ByMaterial can turned on", "Set By material")
				End Try
			Next
		End If
	Next
Next

 

0 Likes
Message 3 of 4

kresh.bell
Collaborator
Collaborator

works, but is it possible to simply skip this message for materials for which Hatch is not defined?

 

Screenshot 2021-11-05 111759.jpg

0 Likes
Message 4 of 4

theo.bot
Collaborator
Collaborator
Accepted solution

just remove the line:

 

MessageBox.Show("The Material of the sectioned component is not in Style definition, please add the material before ByMaterial can turned on", "Set By material")
0 Likes