嗨
,我可以使用以下代码解决问题:
- Dim lineObj2 As Variant, lineObj3 As AcadLine
- lineObj2 = lineObj.Offset(2 * Round(lineObj.Length, 2))
-
- Dim ent As AcadEntity
- Set ent = ThisDrawing.ModelSpace(ThisDrawing.ModelSpace.Count - 1)
- If ent.ObjectName = "AcDbLine" Then
- Set lineObj3 = ent
- ent.Highlight True
- Dim AA As Variant
- Dim BB As Variant
- Dim CC As Variant
- AA = lineObj3.startPoint
- BB = lineObj3.endPoint
- CC(0) = (AA(0) + BB(0)) * 0.5
- CC(1) = (AA(1) + BB(1)) * 0.5
- CC(2) = (AA(2) + BB(2)) * 0.5
- Debug.Print CC(0), CC(1), CC(2)
- Else
- End If
但我认为有更好的方法,所以如果你有更好的建议,请说出来。 |