<p></p>请问mccad,怎么在程序中给定个点来表示所要的圆角靠近哪个端?谢谢! <p>我已经试验成功了。。。感谢高人的指点,对于那个点的设定,我的理解是,点是用来确定,圆角倒的方向的,所以,点只要设定在要倒圆角的内部就可以了。</p><p>整个的程序代码如下:供大家指证。。。</p><p>Public AcadApp As AcadApplication<br/>'Public oDocument As Object<br/>Dim centerPoint(0 To 2) As Double</p><p>Public Function axEnt2lspEnt(entObj As AcadEntity) As String</p><p><br/>Dim entHandle As String<br/>entHandle = entObj.Handle<br/>axEnt2lspEnt = "(handent " & Chr(34) & entHandle & Chr(34) & ")"<br/>End Function</p><p><br/>Public Function GetDoubleEntTable(entObj As AcadEntity, Pnt As Variant) As String<br/> Dim entHandle As String<br/> entHandle = entObj.Handle<br/> GetDoubleEntTable = "(list(handent " & Chr(34) & entHandle & Chr(34) & ")(list " & Str(Pnt(0)) & Str(Pnt(1)) & Str(Pnt(2)) & "))"<br/> End Function</p><p>Private Sub Command1_Click()</p><p></p><p>''''''''''''''''''''''''''''''''''''''''''''''''''''Addarc</p><p>Dim arcNxObj As Object<br/>Dim arcNsObj As Object</p><p><br/>Dim radiusARCNx As Double<br/>Dim startAngleInDegreeN As Double<br/>Dim endAngleInDegreeN As Double<br/>Dim startAngleInRadianN As Double<br/>Dim endAngleInRadianN As Double</p><p><br/>'Dim blockObj As AcadBlock<br/>'Set blockObj = AcadApp.ActiveDocument.SelectionSets.Add("FWw")</p><p><br/>radiusARCNx = 15#</p><p>startAngleInDegreeN = 0#<br/>endAngleInDegreeN = 45#</p><p>startAngleInRadianN = startAngleInDegreeN * 3.141592 / 180#<br/>endAngleInRadianN = endAngleInDegreeN * 3.141592 / 180#</p><p>Set arcNxObj = AcadApp.ActiveDocument.ModelSpace.AddArc(centerPoint, radiusARCNx, startAngleInRadianN, endAngleInRadianN)</p><p>Dim arcNs As Object<br/>Dim radiusARCNs As Double<br/>radiusARCNs = 25#</p><p>Set arcNsObj = AcadApp.ActiveDocument.ModelSpace.AddArc(centerPoint, radiusARCNs, startAngleInRadianN, endAngleInRadianN)<br/>Dim endPointNx As Variant<br/>Dim startPointNx As Variant<br/>Dim endPointNs As Variant<br/>Dim startPointNs As Variant</p><p><br/>arcNsObj.Color = acRed</p><p>startPointNx = arcNxObj.StartPoint<br/>endPointNx = arcNxObj.EndPoint<br/>endPointNs = arcNsObj.EndPoint<br/>startPointNs = arcNsObj.StartPoint<br/>Dim lineObj1 As Object<br/>Dim lineObj2 As Object</p><p>Set lineObj1 = AcadApp.ActiveDocument.ModelSpace.AddLine(startPointNx, startPointNs)<br/>Set lineObj2 = AcadApp.ActiveDocument.ModelSpace.AddLine(endPointNx, endPointNs)</p><p>ZoomExtents</p><p>'''''''''''''''''''''''想实现fillet 直线与圆弧的圆角功能<br/>Dim Pnt1 As Variant<br/>Dim det1 As String<br/>Dim Pnt2 As Variant<br/>Dim det2 As String<br/>det1 = axEnt2lspEnt(arcNsObj)<br/>Pnt2 = lineObj1.EndPoint<br/>Pnt2(0) = Pnt2(0) - 1<br/>det2 = GetDoubleEntTable(lineObj1, Pnt2)<br/>AcadApp.ActiveDocument.SendCommand "_fillet" & vbCr & "r" & vbCr & "2" & vbCr & "t" & vbCr & "t" & vbCr & det1 & vbCr & vbCr & det2 & vbCr</p><p>Dim DaoJiao(4) As AcadEntity</p><p><br/>Set DaoJiao(0) = AcadApp.ActiveDocument.ModelSpace(AcadApp.ActiveDocument.ModelSpace.Count - 1)</p><p><br/>det1 = axEnt2lspEnt(arcNsObj)<br/>Pnt2 = lineObj2.EndPoint<br/>Pnt2(0) = Pnt2(0) - 1<br/>det2 = GetDoubleEntTable(lineObj2, Pnt2)<br/>AcadApp.ActiveDocument.SendCommand "_fillet" & vbCr & "r" & vbCr & "2" & vbCr & "t" & vbCr & "t" & vbCr & det1 & vbCr & vbCr & det2 & vbCr<br/>Set DaoJiao(1) = AcadApp.ActiveDocument.ModelSpace(AcadApp.ActiveDocument.ModelSpace.Count - 1)</p><p><br/>det1 = axEnt2lspEnt(arcNxObj)<br/>Pnt2 = lineObj2.EndPoint<br/>arcNxObj.Color = acGreen<br/>Pnt2(0) = Pnt2(0) + 1<br/>det2 = GetDoubleEntTable(lineObj2, Pnt2)<br/>AcadApp.ActiveDocument.SendCommand "_fillet" & vbCr & "r" & vbCr & "2" & vbCr & "t" & vbCr & "t" & vbCr & det1 & vbCr & vbCr & det2 & vbCr<br/>Set DaoJiao(2) = AcadApp.ActiveDocument.ModelSpace(AcadApp.ActiveDocument.ModelSpace.Count - 1)</p><p><br/>det1 = axEnt2lspEnt(arcNxObj)<br/>Pnt2 = lineObj1.EndPoint<br/>arcNxObj.Color = acGreen</p><p>Pnt2(0) = Pnt2(0) + 1<br/>det2 = GetDoubleEntTable(lineObj1, Pnt2)<br/>AcadApp.ActiveDocument.SendCommand "_fillet" & vbCr & "r" & vbCr & "2" & vbCr & "t" & vbCr & "t" & vbCr & det1 & vbCr & vbCr & det2 & vbCr<br/>Set DaoJiao(3) = AcadApp.ActiveDocument.ModelSpace(AcadApp.ActiveDocument.ModelSpace.Count - 1)</p><p></p><p>Dim rotationAngle As Double<br/>rotationAngle = 0.7853981 * 1.5 ' 45 degrees</p><p><br/>ReDim ssobjs(0 To AcadApp.ActiveDocument.ModelSpace.Count - 1) As AcadEntity<br/>Dim I As Integer<br/>For I = 0 To AcadApp.ActiveDocument.ModelSpace.Count - 1<br/> <br/> Set ssobjs(I) = AcadApp.ActiveDocument.ModelSpace.Item(I)</p><p> ssobjs(I).Rotate centerPoint, rotationAngle<br/>Next<br/> ZoomExtents<br/> </p><p>'Set oDocument = Nothing<br/>'Set AcadApp = Nothing</p><p>End Sub</p> <p>请教高人有一个新的问题,</p><p>我想将所有的图元都加入一个块,然后用这个块进行阵列,因为,放在集中,集无法阵列</p><p>现在已经知道了,圆弧和线在创建时,就再块中创建,但是倒圆角出来的是个圆弧,由于是用sendcommand出来的,如何再加入已有的块中。</p><p>blockobj中该如何加入已存在的图元?????</p> 不一定用到块吧。你可以每个图元单独进行阵列,写成一个函数就可以。 <p>我就担心每一个图元进行阵列,就要多一个阵列图元。</p><p>我担心阵列完,图元太多了。</p><p></p> 学习了,正在研究
页:
1
[2]