Accessing "Edit Hatch Pattern" in sectioned drawing view via iLogic

Accessing "Edit Hatch Pattern" in sectioned drawing view via iLogic

ReneRepina
Collaborator Collaborator
1,771 Views
7 Replies
Message 1 of 8

Accessing "Edit Hatch Pattern" in sectioned drawing view via iLogic

ReneRepina
Collaborator
Collaborator

Hello!

 

Is there a possibility to access "Edit Hatch Pattern" in sectioned drawing view via iLogic?

 

I know how to access a specific drawing view, but not sure how to proceed:

ThisDrawing.Document.ActiveSheet.DrawingViews(1)

Probably view has to be "SectionDrawingView", but still I do not know how to access the "Hatch" inside it.

 

 I am using Inventor 2020.5.

 

ReneRepina_0-1647443583509.png

 

Best regards,

Rene Repina

 

0 Likes
Accepted solutions (2)
1,772 Views
7 Replies
Replies (7)
Message 2 of 8

WCrihfield
Mentor
Mentor
Accepted solution

Hi @ReneRepina.  Yes...in a way.  There is a special, more specific type of view object just for section views, called 'SectionDrawingView', and it has a property called 'HatchRegions' (just added in Inventor 2022) which you can use to dig down into those areas.  The URL's to the HatchRegions property and all the other related stuff is still messed up, so I can't provide links to those here.  You will have to navigate down into them from the other link provided, if you want to.

Here is a fairly simple example of some iLogic code to get you started, if you have Inventor 2022.

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
			'oHatchR.Angle
			'oHatchR.BoundaryGeometries
			'oHatchR.ByMaterial
			'oHatchR.Color
			'oHatchR.DoublePattern
			'oHatchR.HatchAreas
			'oHatchR.Layer
			'oHatchR.LineWeight
			'oHatchR.Pattern
			'oHatchR.Scale
			'oHatchR.Shift
			'oHatchR.Visible
		Next
	End If
Next

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 8

ReneRepina
Collaborator
Collaborator

Hi @WCrihfield !

 

Thanks for the information, this is what I needed!

I point it down to "SectionDrawingView", but got stuck there. I use Inventor 2020.5, so I will be unable to find and test as you suggested for now. We will upgrade to Inventor 2022 soon and I will try it then.

Thanks for the help!

0 Likes
Message 4 of 8

brianM328K
Enthusiast
Enthusiast
Accepted solution

Hi @ReneRepina 

 

If anyone is still interested in drawing sketch hatch manipulation, you may like the attached code. Its something I have been working on.

(Note: this code will edit all hatches in that view. If any one knows how to select a small group of hatches only Please let me know)

 

brianM328K_0-1707837178535.png

 

Edited: 02/04/2024

Sorry I don't know where that first line came from. It has now been removed.

Message 5 of 8

kadscad
Collaborator
Collaborator

THANK YOU THANK YOU

I had to remark out the 1st line for it to work.

 

Kirk
Inventor 2023
Message 6 of 8

ReneRepina
Collaborator
Collaborator

Hello @brianM328K .

 

Sorry for the late reply.

 

Thank you for putting efford into this code and sharing it.

We are still interested. I did not test it yet though. Maybe I will do it soon.

 

As for your case "select a small group of hatches", maybe you can try to filter them out by checking how big a part is in sketch compared to other parts. This is just an idea from top of my head, but I think code can be pretty complex to achieve that.

 

 

Best regards,

Rene Repina

0 Likes
Message 7 of 8

mtoddHBKNF
Participant
Participant

This code works great but changes the hatch for the entire view all going on the same direction which is not ideal. Have you found a way to select and change just one material with ilogic?

0 Likes
Message 8 of 8

brianM328K
Enthusiast
Enthusiast

Hi.

Thanks for reacing out. I'm still not aware of a way to do that.

However i am constently trying to improve on the code. I have add a section to set certain patterns to a predefined angle which may be a work around that you can use.

brianM328K_1-1752736324270.png

I have attached a file with the revised ilogic code along with my icons for it. Also there are 2 hatch pattern files that need to be placed in your global forms folder "\Design Data\iLogic\UI" this is a pop up that shows the std hatches.

brianM328K_0-1752736132266.png

Please let me know how you get on.

 

0 Likes