edit hatch and selectionsets

edit hatch and selectionsets

Anonymous
Not applicable
685 Views
3 Replies
Message 1 of 4

edit hatch and selectionsets

Anonymous
Not applicable

I have several hatch objects in a modelspace.

I want to edit those hatches by vba. I prefer without selection by the user. 

(All hatches must be separated  I learned this must be done with sendcommand see my other topic).

I searched the helpfile and found acadselectionset. I don't know this is the right way and how I use this with the sendcommand method. Important I want vba to select the hatch.

 

I hope you understand what I mean

please you can help me?

 

gr. Laszlo

0 Likes
686 Views
3 Replies
Replies (3)
Message 2 of 4

truss_85
Advocate
Advocate

There is no need to use sendcommand here is the code you needed.

 

Public Sub hatch_sel()

Dim oHatch As AcadHatch
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant

On Error Resume Next
ThisDrawing.SelectionSets.Item("SS1").Delete
Dim ssetObj As AcadSelectionSet
Set ssetObj = ThisDrawing.SelectionSets.Add("SS1")

FilterType(0) = 0
FilterData(0) = "HATCH"

ssetObj.Select acSelectionSetAll, , , FilterType, FilterData

n = 0
For Each Item In ssetObj
    Set oHatch = ssetObj.Item(n)
    'do what you want to do
    n = n + 1
Next Item

ThisDrawing.SelectionSets.Item("SS1").Delete
End Sub

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thank you!

Now I understand filter in selectionset.

The sendcommand method I need to seperate already drawed hatches in the drawing.

 

gr. Laszlo

0 Likes
Message 4 of 4

truss_85
Advocate
Advocate

Glad to help.

0 Likes