Change values of several hatch patterns

Change values of several hatch patterns

KOKAK
Enthusiast Enthusiast
1,060 Views
8 Replies
Message 1 of 9

Change values of several hatch patterns

KOKAK
Enthusiast
Enthusiast

Necesito seleccionar varios patrones de sombreado en una vista en sección de dibujo y asignarles a todos los mismos valoresmediante VBasic pero no encuentro la manera de hacerlo. Por ejemplo, todos a 45 grados de ángulo y a 0,25 de escala. 

Perdonar por mi mal ingles.

 

 

I need to select various shading patterns in a section view drawing and assign
all the same settings using VBasic but can not find the way to go. For example, all
a 45 degree angle and scale to 0.25.

Forgive for my bad English.


0 Likes
1,061 Views
8 Replies
Replies (8)
Message 2 of 9

ekinsb
Alumni
Alumni

Unfortuately there is not currently any API support to access the hatching that's created as the result of a section.  I don't know of any workarounds.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 9

Anonymous
Not applicable

I would like to do the same!

Just like in AutoCAD.

0 Likes
Message 4 of 9

ACEDeSmedt
Advocate
Advocate

Somebody found a workaround yet?

=================================
If this is the solution, push the solution button 😉 (and maybe some kudos)
Autodesk Product Design Suit - Ultimate edition (Subscription)
0 Likes
Message 5 of 9

^_^clovis^_^
Advocate
Advocate

Hello,

I'm having the same issue with Inventor 2017.

Is there a "vba" way to rotate all hatches after a view has been rotated?

Thanks

0 Likes
Message 6 of 9

KOKAK
Enthusiast
Enthusiast

At the moment I do not see a solution since the inventor API does not give access to the subject of shading. But I have it among my main objectives.

 

Excuse my English from Google

 

De momento no le veo solución ya que el API de inventor no da acceso al tema de los sombreados. Pero lo tengo entre mis principales objetivos.

 

Perdone mi ingles de Google

0 Likes
Message 7 of 9

brianM328K
Enthusiast
Enthusiast

Hi there its been a long time since the last post here.

Has anyone found a solution to this issue about batch rotating and scaling a hatch pattern yet ???

 

Kind Regards

 

0 Likes
Message 8 of 9

david_alcalde6P6BN
Contributor
Contributor

If you have Inventor 2022 or onwards this should do:

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

 

 the solution is from this post:
https://forums.autodesk.com/t5/inventor-programming-ilogic/accessing-quot-edit-hatch-pattern-quot-in...

0 Likes
Message 9 of 9

brianM328K
Enthusiast
Enthusiast
Hi @david_alcalde6P6BN. Thanks for your reply
 
 
I have since managed to put the bellow together.
However I would like the option to be able to select individual / a group of hatches to modify rather than the entire view.
 

Hello All

@cadman777 I have put together a code that will allow you to do the following.

First it asks you to select a view you would like to edit the hatching in, once you have picked a view the following pops up. (Note: this code will edit all hatches in that view)

 

brianM328K_0-1703157117607.png

 

brianM328K_1-1703157117624.png

 

brianM328K_2-1703157117581.png

 

brianM328K_3-1703157117603.png

 

I would like to be able to select a group of hatching to edit but am struggling to work that part out. Attached is the code if you want to use it.

I hope this is of help .

 

Sub Note 13/02/2024

I have attached a revised version of the code with enhanced user interface and features. You can now also adjust the hatch pattern.

brianM328K_0-1707836558794.png

 

 

Regards Brian.