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

How to seperate hatches in a drawing

2 REPLIES 2
Reply
Message 1 of 3
lanieuwe
660 Views, 2 Replies

How to seperate hatches in a drawing

Normally you can do this with hatchedit -> options -> create separate hatches.

 

also "HPSEPARATE" on the command.

 

How can I separate the already drawn hatches in a drawing with vba?

 

I can't find such a method.

 

gr Laszlo

2 REPLIES 2
Message 2 of 3
Hallex
in reply to: lanieuwe

Use SendCommand to do it, e.g.:

Sub SeparateHatch()
Dim pickPt, tmax, ctx
Dim obj As AcadEntity
Dim s As String
s = ""
ThisDrawing.Utility.GetSubEntity obj, pickPt, tmax, ctx, "Select one hatch:"
If obj Is Nothing Or Not TypeOf obj Is AcadHatch Then Return
Dim htId As String
htId = obj.Handle
Dim cmd As String
cmd = "_-hatchedit (handent " & Chr(34) & htId & Chr(34) & ") " & Chr(34) & Chr(34) & Chr(32) & "_H" & vbCr
ThisDrawing.SendCommand cmd
MsgBox "Pokey"
End Sub

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 3
lanieuwe
in reply to: Hallex

Thank you hallex!

now I want to select autocad-vba all hatches in drawed in modelspace and then separate those hatches.

 

I tried it with this code selectionset but I don't now how exactly:

Private Sub CommandButton1_Click()

Dim hatchset As AcadSelectionSet 

Set hatchset = ThisDrawing.SelectionSets.Add("hatchset") 
On Error GoTo 0
hatchset.Select acSelectionSetAll
ThisDrawing.SendCommand "-hatchedit" & vbCr & vbCr & "H" & vbCr

End Sub

 Can you help me?

gr. Laszlo

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

Post to forums  

Autodesk Design & Make Report

”Boost