vbacad给定坐标绘制管线矩形(长7.5,高1.995)

Public Sub drawrec()
Dim pt1 As Variant
Dim polyobj As AcadLWPolyline
    pt1 = ThisDrawing.Utility.GetPoint(, "拾取第一个点:")
     Dim objRec As AcadLWPolyline
     Dim vertices(9) As Double
     vertices(0) = pt1(0): vertices(1) = pt1(1)
      vertices(2) = pt1(0) + 7.5: vertices(3) = pt1(1)
      vertices(4) = pt1(0) + 7.5: vertices(5) = pt1(1) + 1.995
      vertices(6) = pt1(0): vertices(7) = pt1(1) + 1.995
      vertices(8) = pt1(0): vertices(9) = pt1(1)
      
      set polyobj = ThisDrawing.ModelSpace.AddLightWeightPolyline(vertices)
      polyobj.Closed = True
      ThisDrawing.Application.ZoomAll
End Sub
 

你可能感兴趣的:(VBA,CAD,开发语言)