但如果是把三维多段线炸开转成线段后,就可以把他们转成一般的多段线(命令PE)。而且对于同一个平面内的相连线段还可以进一步转为单条多段线,具体操作:先把UCS转到该平面上,输入命令PE,选全部线段,Y(转为多段线),J(合并),回车,回车。
2013-09-19
三维转成二维且连续,二维的高程(标高)值就是一个定值。可以用LISP\VBA编程实现,以三维多段线的第一个点的Z坐标值为转换后二维多段线的标高值。
三维多段线(节点数量不限):
命令:"3dto2d"
转换成多段线
可多条批量选择处理
主要代码
Dim ssddx As AcadSelectionSet, tddx As Acad3DPolyline, FTddx(0) As Integer, FDddx(0) As Variant
Dim retCoord() As Double
Dim i, k As Double
Dim l() As Double
Dim lobj As AcadLWPolyline
Do While ThisDrawing.SelectionSets.Count > 0 '删除所有选择集避免出错
ThisDrawing.SelectionSets.Item(0).Delete
Loop
FTddx(0) = 0: FDddx(0) = "polyLINE"
Set ssddx = ThisDrawing.SelectionSets.Add("ssddx")
ssddx.SelectOnScreen FTddx, FDddx
If ssddx.Count > 0 Then
For Each tddx In ssddx '遍历对象
For i = 0 To UBound(tddx.Coordinates) \ 3
ReDim Preserve l(0 To i * 2 + 1)
l(i * 2) = tddx.Coordinates(i * 3)
l(i * 2 + 1) = tddx.Coordinates(i * 3 + 1)
Next i
Set lobj = ThisDrawing.ModelSpace.AddLightWeightPolyline(l)
lobj.Elevation = tddx.Coordinates(2) '附标高值
lobj.Layer = tddx.Layer
tddx.Delete '删除对象
Next '遍历对象
End If
ssddx.Delete '删除选择集
For i = 0 To UBound(tddx.Coordinates) \ 3
ReDim Preserve l(0 To i * 2 + 1)
l(i * 2) = tddx.Coordinates(i * 3)
l(i * 2 + 1) = tddx.Coordinates(i * 3 + 1)
Next i
Set lobj = ThisDrawing.ModelSpace.AddLightWeightPolyline(l)
lobj.Elevation = tddx.Coordinates(2) '附标高值
lobj.Layer = tddx.Layer