VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

edit hatch and selectionsets

3 REPLIES 3
Reply
Message 1 of 4
lanieuwe
531 Views, 3 Replies

edit hatch and selectionsets

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

3 REPLIES 3
Message 2 of 4
truss_85
in reply to: lanieuwe

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

 

Message 3 of 4
lanieuwe
in reply to: lanieuwe

Thank you!

Now I understand filter in selectionset.

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

 

gr. Laszlo

Message 4 of 4
truss_85
in reply to: lanieuwe

Glad to help.

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

Post to forums  

Autodesk Design & Make Report

”Boost