本帖最后由 作者 于 2008-4-18 21:24:40 编辑
想做个能根据图框然后可以自动排序从上到下从左到右或从下到上从右到左进行批量打印的程序,下面是写到了读完各图框打印区坐标(LBpt(i)-RTpt(i))后如何进行二维排序的问题,不知各位高手门有没有什么好的方法对LBpt()根据X、Y值进行从左到右或从下到上从右到左进行排序的好方法呢? Private Type pt X As Double Y As Double End Type Private Type pt X As Double Y As Double End Type Dim LBpt(),RTpt() As pt Dim LBpttmp,RTpttmp As Variant Dim Sset As AcadSelectionSet Dim FilterType(5) As Integer Dim FilterData(5) As Variant Dim AcadEntity As AcadEntity Dim num As Integer FilterType(0) = -4 FilterData(0) = "<or" FilterType(1) = 0 FilterData(1) = "Insert" FilterType(2) = 0 FilterData(2) = "LWPOLYLINE" FilterType(3) = 0 FilterData(3) = "POLYLINE" FilterType(4) = -4 FilterData(4) = "or>" FilterType(5) = 8 FilterData(5) = "图框" Set Sset = ThisDrawing.SelectionSets.Add("sse1") ThisDrawing.Utility.Prompt (vbCrLf & "请选择要打印的图框(要求图框为块或者多段线):") Sset.SelectOnScreen FilterType, FilterData For Each AcadEntity In Sset AcadEntity.GetBoundingBox LBpttmp, RTpttmp Num = Num + 1 ReDim Preserve MinPoints(1 To Num) ReDim Preserve MaxPoints(1 To Num) LBpt(Num).X = LBpttmp(0) LBpt(Num).Y = LBpttmp(1) RTpt(Num).X = RTpttmp(0) RTpt(Num).Y = RTpttmp(1) Next |