Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

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

ReneRepina
Collaborator
Collaborator

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
Reply
Accepted solutions (2)
1,140 Views
5 Replies
Replies (5)

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)

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

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.

kadscad
Collaborator
Collaborator

THANK YOU THANK YOU

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

 

Kirk
Inventor 2023

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