Visual Basic Customization

Visual Basic Customization

Reply
Valued Contributor
lanieuwe
Posts: 57
Registered: ‎10-26-2011
Message 1 of 3 (285 Views)

How to seperate hatches in a drawing

285 Views, 2 Replies
02-01-2013 03:12 AM

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

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 3 (269 Views)

Re: How to seperate hatches in a drawing

02-01-2013 10:54 PM 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
Valued Contributor
lanieuwe
Posts: 57
Registered: ‎10-26-2011
Message 3 of 3 (251 Views)

Re: How to seperate hatches in a drawing

02-05-2013 12:28 PM 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.