不知你还要怎么简单,这里给你提供个程序吧,这还不简单,还有什么更简单的?
注意新生成的对象在NewEnt数组中。
- Sub ExplorePline()
- Dim Ent As AcadLWPolyline
- Dim Pnt As Variant
- On Error Resume Next
- Do
- ThisDrawing.Utility.GetEntity Ent, Pnt, "选择要分解的多段线:"
- If Err <> 0 Then
- Err.Clear
- Else
- Exit Do
- End If
- Loop
- Dim PointCount As Integer
- PointCount = (UBound(Ent.Coordinates) + 1) / 2
- Dim NewEnt() As AcadLWPolyline
- ReDim NewEnt(PointCount - 1)
- Dim i As Integer
- Dim Pnts(3) As Double
- Dim Bulge As Double
- Dim SWidth As Double
- Dim EWidth As Double
- For i = 1 To PointCount - 1
- Pnts(0) = Ent.Coordinate(i - 1)(0)
- Pnts(1) = Ent.Coordinate(i - 1)(1)
- Pnts(2) = Ent.Coordinate(i)(0)
- Pnts(3) = Ent.Coordinate(i)(1)
- Bulge = Ent.GetBulge(i - 1)
- Ent.GetWidth i - 1, SWidth, EWidth
- Set NewEnt(i - 1) = ThisDrawing.ModelSpace.AddLightWeightPolyline(Pnts)
- NewEnt(i - 1).SetBulge 0, Bulge
- NewEnt(i - 1).SetWidth 0, SWidth, EWidth
- NewEnt(i - 1).Color = Ent.Color
- NewEnt(i - 1).Layer = Ent.Layer
- NewEnt(i - 1).Linetype = Ent.Linetype
- Next
- Update
- End Sub
还有一种方法可能是让你会觉得简单,就是用break命令在每个顶点处断开。自己写程序吧。 |