怎样修改三维多段线和样条曲线的高程(Z 坐标)
多段线可以直接修改Poline.Elevation = GC '海拔Dim Poline As Polyline = CType(cTrans.GetObject(obj.ObjectId, OpenMode.ForWrite, True), Polyline) '获取多段线实体对象
Dim GC As Double = Poline.Elevation
GC += Text_GC.Text
Poline.Elevation = GC '海拔
Case "Polyline3d"'三维多段线
Dim Poline As Polyline3d = CType(cTrans.GetObject(obj.ObjectId, OpenMode.ForWrite, True), Polyline3d) '获取多段线实体对象
Dim pts = New Point3dCollection()
Poline.GetStretchPoints(pts)
Dim pt3d As New Point3dCollection()
For Each pot3d As Point3d In pts
Dim po3d As New Point3d(pot3d.X, pot3d.Y, pot3d.Z + Text_GC.Text)
pt3d.Add(po3d)
Next
'Poline.GetStretchPoints(pts) = pt3d
‘现在只能 重新生成三维多段线后删除原线
Dim poly3dId As ObjectId = ModelSpace.Add3dPoly(pt3d)
Poline.Erase() '删除原线
arx 的有 AcDb3dPolylineVertex
net 的有 PolylineVertex3d
VB.net 应该也有对应的 Dim PL3DID As ObjectId = ObjectId.Null
Using Trans As Transaction = Doc.TransactionManager.StartTransaction
Dim PL3D As Polyline3d = Trans.GetObject(PL3DID, OpenMode.ForRead)
For Each VID As ObjectId In PL3D
Dim Vertex As PolylineVertex3d = Trans.GetObject(VID, OpenMode.ForWrite)
Vertex.Position = Vertex.Position + New Vector3d(0.0, 0.0, Convert.ToDouble(Text_GC.Text))
Next
Trans.Commit()
End Using
Dim PL3DID As ObjectId = ObjectId.Null这个ID根据自己的实际情况替换 guohq 发表于 2023-6-1 10:40
Dim PL3DID As ObjectId = ObjectId.Null这个ID根据自己的实际情况替换
谢谢 giohq
样条曲线是这样吗
Dim sp As Spline = TryCast(cTrans.GetObject(entity.ObjectId, OpenMode.ForRead), Spline)
For j As Integer = 0 To sp.NumControlPoints - 1 '遍历获取多段线顶点坐标
Dim point As Point3d = sp.GetControlPointAt(j) '控制点
'Dim point As Point3d = sp.SetFitPointAt(j) '拟合点
If Option_A.Checked = True Then '+
point = New Point3d(point.X, point.Y, point.Z + Text_GC.Text) '控制点
End If
If Option_C.Checked = True Then '=
point = New Point3d(point.X, point.Y, Text_GC.Text) '控制点
End If
sp.SetControlPointAt(j, point) '设置控制点
'sp.SetFitPointAt(j, point) '设置拟合点
Next 从代码上看应该没有问题,以我的从业经验来看,测量绘图中很少用到样条曲线的,一般都会做拆线化处理
页:
[1]