我看到有的二次开发的程序可以将两个物体帮到一起,这是怎么实现的啊??
我所知道的CAD线型是一种有规律的符号线,线上的符号不能准确的落到这条线的VERTEX上。我看到有一种方法是将符号和母线组合起来,无论是选择符号还是选择母线都能将这两个(或者更多)要素一同选中,选中的要素在特征栏里看是一组要素,而且每个要素都有自己的特征信息,请问各位高手这种方法是怎样实现的啊??除了这个方法外还有什么方法可以将线型里的符号定位到VERTEX上?
再此谢过!! 没有人知道方法吗? 这是组合的功能,在VBA中可以试试sendcommand的方法(-group). 好的,让我试一试! 把符号定义成属性放到顶点上再生成块就可以了。 给个vba的函数,用了匿名group,好用
'将选定的对象组合<BR>Sub ag()<BR>On Error Resume Next<BR> Dim SelObjects As AcadSelectionSet<BR> Set SelObjects = GetSelSet<BR> Dim UnNameGroup As AcadGroup<BR> 'On Error Resume Next<BR> Set UnNameGroup = ThisDrawing.Groups.Add("*")<BR> ReDim appendObjs(0 To SelObjects.count - 1) As AcadEntity<BR> Dim i As Integer<BR> For i = 0 To SelObjects.count - 1<BR> Set appendObjs(i) = SelObjects.Item(i)<BR> Next<BR> <BR> UnNameGroup.AppendItems appendObjs<BR> SelObjects.Delete<BR>End Sub
'将选定的组合分解开<BR>'由于不能通过选定的对象来直接找到其组合名称,只能通过循环比较对象ID的方法<BR>'来解决这个问题,运行时可能会慢点,但对象不多的情况下应该没问题<BR>Sub Dg()
Dim SelGroup As AcadGroup<BR> Dim SelObjects As AcadSelectionSet<BR> Set SelObjects = GetSelSet<BR> Dim ObjInSelSet As AcadObject<BR> Dim i As Integer<BR> Dim j As Integer<BR> Dim k As Integer<BR> Dim ObjInGroup As AcadObject<BR> On Error Resume Next<BR> For i = 0 To SelObjects.count - 1<BR> Set ObjInSelSet = SelObjects.Item(i)<BR> For j = 0 To ThisDrawing.Groups.count - 1<BR> For k = 0 To ThisDrawing.Groups.Item(j).count - 1<BR> Set ObjInGroup = ThisDrawing.Groups.Item(j).Item(k)<BR> If ObjInGroup.ObjectID = ObjInSelSet.ObjectID Then<BR> ThisDrawing.Groups.Item(j).Delete<BR> Exit For<BR> End If<BR> Next<BR> Next<BR> Next<BR> SelObjects.Delete<BR>End Sub
'对象选择函数<BR>Function GetSelSet() As AcadSelectionSet<BR> Dim ss As AcadSelectionSet<BR> Set ss = ThisDrawing.PickfirstSelectionSet<BR> On Error Resume Next<BR> If ss.count = 0 Then<BR> Dim ssName As String<BR> ssName = "str1SSet"<BR> On Error Resume Next<BR> Set ss = ThisDrawing.SelectionSets(ssName)<BR> If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)<BR> ss.Clear<BR> ss.SelectOnScreen<BR> End If<BR> Set GetSelSet = ss<BR>End Function
<BR>
页:
[1]