Announcements

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

Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
ReneRepina
1140 Views, 5 Replies

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

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

 

5 REPLIES 5
Message 2 of 6
WCrihfield
in reply to: ReneRepina

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 6
ReneRepina
in reply to: WCrihfield

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!

Message 4 of 6
brianM328K
in reply to: ReneRepina

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 6
kadscad
in reply to: brianM328K

THANK YOU THANK YOU

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

 

Kirk
Inventor 2023
Message 6 of 6
ReneRepina
in reply to: ReneRepina

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report