看看这个
键入VBAMAN New pick the global1,visual basic编辑器,双击global1左上角的“代码”窗口应打开“粘贴代码并保存”以查看结果使用RUN sub/userform try 1作为间隔。更多的是关于如何做的方法。您还需要一个新的顶点lsp来计算显示的顶点数和间距。目前的时间是一个完整解决方案的问题。
Sub draw_vehicle()Dim CAR As StringDim arcobj As AcadArcDim oPoly As AcadEntityDim blkobj As AcadEntityDim retVal As VariantDim snapPt As VariantDim oCoords As VariantDim blpnt1() As VariantReDim blpnt1(100)Dim blpnt2() As VariantDim vertPt(0 To 2) As DoubleDim Pt1(0 To 2) As DoubleDim Pt2(0 To 2) As DoubleDim newPt(0 To 2) As DoubleDim iCnt, w, x, y, z As IntegerDim cRad, interval, blkangle As DoubleDim circObj As AcadCircleDim lineObj As AcadLineOn Error GoTo Something_WrongFor Each Item In ThisDrawing.BlocksIf Item.Name = "temp" Then GoTo continue_onNext Item' exits out of programGoTo Exit_outcontinue_on:w = 1ThisDrawing.Utility.GetEntity oPoly, snapPt, vbCr & "Select polyline :"If oPoly.ObjectName = "AcDbPolyline" ThenoCoords = oPoly.CoordinatesElse: MsgBox "This object is not a polyline!"Exit SubEnd Ifinterval = CDbl(InputBox("Enter interval:", , 1#))If interval < 1 Theninterval = 1End IfFor iCnt = 0 To UBound(oCoords) - 2 Step 2Pt1(0) = oCoords(iCnt): Pt1(1) = oCoords(iCnt + 1): Pt1(2) = 0#newPt(0) = Pt1(0)newPt(1) = Pt1(1)newPt(2) = 0#iCnt = iCnt + 2Pt2(0) = oCoords(iCnt): Pt2(1) = oCoords(iCnt + 1): Pt2(2) = 0#x = (Pt1(0) - Pt2(0)) / intervaly = (Pt1(1) - Pt2(1)) / interval'reset back 2 valuesiCnt = iCnt - 2cRad = 7#startang = 4.7123889endang = 1.57079632CAR = "temp"For z = 1 To intervalvertPt(0) = newPt(0) - xvertPt(1) = newPt(1) - yvertPt(2) = 0#'blpnt1(w) = vertPtSet arcobj = ThisDrawing.ModelSpace.AddArc(vertPt, cRad, endang, startang)retval2 = arcobj.IntersectWith(oPoly, acExtendOtherEntity)arcobj.DeleteSet arcobj = Nothingblkangle = ThisDrawing.Utility.AngleFromXAxis(retval2, vertPt)Set blkobj = ThisDrawing.ModelSpace.InsertBlock(vertPt, CAR, 1#, 1#, 1#, blkangle)Set blkobj = Nothingw = w + 1newPt(0) = newPt(0) - xnewPt(1) = newPt(1) - yNext zNext iCntSomething_Wrong:MsgBox Err.DescriptionExit_out:End Sub