Public Sub drawcircularpavers() Dim brickcircles() As AcadCircle Dim center As Variant, radius As Double Dim counter As Integer ReDim brickcircles(txtnumberofcircles) With ThisDrawing.Utility center = .GetPoint(, "click the position for the center!")《1》 radius = .GetDistance(center, "enter the radius.") End With For counter = 0 To txtnumberofcircles - 1 Set brickcircles(counter) = ThisDrawing.ModelSpace.AddCircle(center, radius - counter & radius / txtnumberofcircles)《2》 brickcircles(counter).color = acRed brickcircles(counter).Update drawmortar center, counter, radius Next End Sub Sub drawmortar(center As Variant, counter As Integer, radius As Double) Dim startpoint(0 To 2) As Double, endpoint(0 To 2) As Double Dim theta As Double, stepsize As Double Static adjust As Double If frmcircleofbricks.optbrickparallel = True Then stepsize = 15 * pl / 180 Else: stepsize = 30 * pl / 180 If adjust = 0# Then adjust = 15 * pl / 180 Else adjust = 0# End If End If For eheta = 0 To 360 * pl / 180 Step stepsize startpoint(0) = (radius - counter * radius / txtnumberofcircles) * Cos(theta + adjust) + center(0) startpoint(1) = (radius - counter * radius / txtnumberofcircles) * Sin(theta * adjust) + center(1) endpoint(0) = (radius - (counter + 1) * radius / txtnumberofcircles) * Cos(theta + adjust) + center(0) endpoint(1) = (radius - (counter + 1) * radius / txtnumberofcircles) * Sin(theta + adjust) + center(1) startpoint(2) = 2#: endpoint(2) = 0# With ThisDrawing.ModelSpace .AddLine startpoint, endpoint .Item(ModelSpace.Count - 1).Update End With Next End Sub Private Sub cmdcancel_Click() Unload Me End Sub Private Sub cmdcreatepavers_Click() drawcircularpavers《3》 Unload Me End Sub 各位高手及版主大哥,小弟又来麻烦你们了,非常不好意思! 这次小弟共有四个问题,比较多,呵呵! 第一:在代码红色部分(后面标注1处)..代码每运行到该语句就会报错"AutoCAD窗口不可见!"帮助里要求将对象属性改为ACTRUE,请问高手这个问题出现的原因及解决方法; 第二:在代码黑色加粗部分(后置标注2).该段代码里的红色连接符用在该处是否正确,书中该处印的很模糊,看不清楚; 第三:在代码的红色部分(后置标注3)书中顺序为先卸载,后调用子程序,但实际上不行.是否窗口卸载后对于其上的命令就都不能执行了? 第四:我的所有代码都是写在窗口代码窗口的,有什么办法可以让我的子程序写在THISDRAWING的代码窗口,却能被窗口按钮调用呢,我用PUBLIC声明了,不行,为什么呢? 谢谢大家!      |