170
1424
8
顶梁支柱
使用道具 举报
Sub FlattenThis(Ent As AcadEntity) Dim obj As AcadEntity Dim oLine As AcadLine Dim oMline As AcadMLine Dim oCirc As AcadCircle Dim oarc As AcadArc Dim oEll As AcadEllipse Dim oPline As AcadLWPolyline Dim oHatch As AcadHatch Dim oSpline As AcadSpline Dim oReg As AcadRegion Dim oPoint As AcadPoint Dim oBref As AcadBlockReference Dim oMt As AcadMText Dim oLeader As AcadLeader Dim Atts, Att Dim P1, P2, P3 Dim Min, Max Dim ins, Cen Dim Zero(2) As Double, El(2) As Double Dim i As Integer Dim oFace As Acad3DFace If TypeOf Ent Is AcadLine Then Set oLine = Ent oLine.Thickness = 0 oLine.StartPoint = Z0(oLine.StartPoint) oLine.EndPoint = Z0(oLine.EndPoint) If oLine.Length = 0 Then oLine.Delete ElseIf TypeOf Ent Is AcadMLine Then Set oMline = Ent P1 = oMline.Coordinates If P1(2) = P1(5) Then If P1(2) 0 Then El(2) = P1(2) oMline.Move El, Zero End If End If ElseIf TypeOf Ent Is AcadCircle Then Set oCirc = Ent oCirc.Thickness = 0 If N1(oCirc) Then oCirc.center = Z0(oCirc.center) End If ElseIf TypeOf Ent Is AcadArc Then Set oarc = Ent If oarc.center(2) 0 Then If isN(oarc) Then oarc.Thickness = 0 If N1(oarc) Then oarc.center = Z0(oarc.center) End If End If End If ElseIf TypeOf Ent Is AcadEllipse Then Set oEll = Ent If N1(oEll) Then Cen = oEll.center If Cen(2) 0 Then oEll.center = Z0(Cen) End If End If ElseIf TypeOf Ent Is AcadLWPolyline Then Set oPline = Ent oPline.Thickness = 0 If N1(oPline) Then oPline.Elevation = 0 End If ElseIf TypeOf Ent Is AcadHatch Then Set oHatch = Ent If N1(oHatch) Then oHatch.Elevation = 0 End If ElseIf TypeOf Ent Is AcadSpline Then Set oSpline = Ent If oSpline.IsPlanar Then P1 = oSpline.FitPoints If UBound(P1) 0 Then If N1(oBref) Then oBref.InsertionPoint = Z0(ins) If oBref.HasAttributes Then Atts = oBref.GetAttributes For Each Att In Atts Att.InsertionPoint = Z0(Att.InsertionPoint) 'Att.TextAlignmentPoint = Z0(Att.TextAlignmentPoint) Next End If End If End If ElseIf TypeOf Ent Is AcadMText Or TypeOf Ent Is AcadText Then Dim Rot As Double Rot = Ent.Rotation If N1(Ent) Then If Ent.TextString = "" Then Ent.Delete Else ins = Ent.InsertionPoint If Not ins(2) = 0 Then If Rot 0 Then Ent.InsertionPoint = Z0(ins) End If End If Ent.Rotation = Rot End If End If ElseIf TypeOf Ent Is AcadLeader Then Set oLeader = Ent P1 = oLeader.Normal If N1(oLeader) Then El(2) = oLeader.Coordinate(0)(2) oLeader.Move El, Zero End If ElseIf TypeOf Ent Is Acad3DFace Then Set oFace = Ent