GetHatchBoundary by VB
Does anybody know if there is a way to obtain the coordinates of a Hatch object through VB(A)?TIA Arno van Eeuwen
Comments
-
Found this example but haven't used it. May be of some use. Let us know.' Find the objects that make up the first loop Dim loopObjs As Variant hatchObj.GetLoopAt 0, loopObjs ' Find the types of the objects in the loop Dim I As Integer Dim objName As String objName = "" For I = LBound(loopObjs) To UBound(loopObjs) objName = objName & loopObjs(I).EntityName & ", " NextJerry
0 -
Thanks Jerry,you've put me on the right track.I've managed to get hold of the coordinates, but only as long as the hatch is Associative. Saw a few discussions about this subject on the web now as well.Initially I was trying all this in V7 (as we have not yet swapped to V8) but V7 does not have this GetLoopAt method. Hence the confusion.In V8 no problem.Regards,Arno
0 -
Sorry, I forgot.For those interested, here's my little scribble that goes the thing. (In V8)Still I could use some background info on the GetLoopAt method.ArnoPrivate Sub GetHatchCoords() Dim MyHatch As BricscadDb.AcadHatch Dim Sset As BricscadApp.AcadSelectionSet Dim FilterType(0 To 1) As Integer Dim FilterData(0 To 1) As Variant FilterType(0) = 0: FilterData(0) = "HATCH" FilterType(1) = 8: FilterData(1) = "0" On Local Error Resume Next ActiveDocument.SelectionSets.Item("Temp").Delete On Local Error GoTo 0 Set Sset = ActiveDocument.SelectionSets.Add("Temp") Sset.Select acSelectionSetAll, , , FilterType, FilterData Set MyHatch = Sset.Item(0) Dim objLoops As Variant MyHatch.GetLoopAt 0, objLoops Dim i As Integer Dim j As Integer Dim Lwpoly As BricscadDb.AcadLWPolyline Dim Coords As Variant For i = LBound(objLoops) To UBound(objLoops) Set Lwpoly = objLoops(i) Coords = Lwpoly.Coordinates For j = LBound(Coords) To UBound(Coords) Step 2 MsgBox Format(Coords(j), "0.0000") & "," & Format(Coords(j + 1), "0.0000"), , "Point " & Format((j / 2) + 1) Next Next End Sub
0