注意:如图所示,在另一条线上画一条线不是很好的绘图实践。 我不明白你在说什么。。
事实上,我想要的是,如图所示,如果可能的话,点击一条线,在上面画另一条线。。它会帮我很多。。。
请告诉我可能性 如果是关于一条线,可以使用下面的代码来获得他的中点;对于多段线,将非常详细:
Point1st = MyLine.StartPoint
Point2nd = MyLine.EndPoint
theAngle = MyLine.Angle
ReDim Point3rd(2)
Point3rd(0) = 0.5 * (Point1st(0) + Point2nd(0)) 'X
Point3rd(1) = 0.5 * (Point1st(1) + Point2nd(1)) 'Y
Point3rd(2) = 0.5 * (Point1st(2) + Point2nd(2)) 'Z
当做 感谢您的回复。。。
但我想在折线上做。。。。
vb u只给出了中点对吗??
但我实际上想要的是在一条多段线上画一条特定长度的线,保持一定距离。。。
请帮我做这个 假设有两个顶点的XoY多段线:
PlineVertexes = MyPLine.Coordinates
DeltaX = PlineVertexes(3) - PlineVertexes(0) 'displacement on X
DeltaY = PlineVertexes(4) - PlineVertexes(5) 'displacement on Y
If DeltaX = 0 Then
theAngle = 0.5 * pi '90 degrees
Else
theAngle = Atn(DeltaY / DeltaX) 'polyline's angle
End If
ReDim Point3rd(2) 'middle point
Point3rd(0) = 0.5 * (PlineVertexes(3) + PlineVertexes(0)) 'X
Point3rd(1) = 0.5 * (PlineVertexes(4) + PlineVertexes(5)) 'Y
Point3rd(2) = 0# 'Z
'calculate new angle by adding or subtracting 90 degrees
NewAngle = theAngle + 0.5 * pi 'LEFT side
'NewAngle = theAngle - 0.5 * pi 'RIGHT side
'calculate the new point at arbitrary distance (1 unit)
NewDistance = 1
ReDim Point4th(2) 'new point
Point4th(0) = Point3rd(0) + NewDistance * Cos(NewAngle)
Point4th(1) = Point3rd(1) + NewDistance * Sin(NewAngle)
Point4th(2) = 0#
ThisDrawing.ModelSpace.AddLine Point3rd, Point4th
当做
页:
1
[2]