Kerry 发表于 2007-10-9 05:39:43

雷尼尔;我会把你交给VB的好手;我们中间的ers
但是如果你把区块贴在你的've使用
并发布一些您'我已经试过了
你在尝试一个完全编程的解决方案吗
每个区块的规则是什么
你知道如何在VBA中选择块插入吗
你知道如何从块表/集合中检索块定义吗
你知道如何遍历集合吗
你知道如何从块中检索X,X,Z比例吗
你知道怎么翻译矩阵吗
你知道如何做向量乘法和加法吗

Bryco 发表于 2007-10-9 20:23:45

kerry,谢谢你给我的问题和回答……这有助于我了解我们的问题……最后,关于你给我提出的第二个问题,比如;您知道如何从块表/集合中检索块定义吗&引用
如何从块表/集合中检索块定义??有什么想法吗
再次感谢;

Bryco 发表于 2007-10-9 20:27:18


类似的东西怎么样
Dim theBlock As AcadBlock
Set theBlock = ThisDrawing.Blocks.Item("WhateverBlockNameYouWant")

Kerry 发表于 2007-10-10 01:32:07

再加一点
Private Sub FindTheBlock()
    Dim oBref As AcadBlockReference
    Dim B As AcadBlock
    Dim Pt As Variant
    Dim C As AcadCircle
    Dim X As Double
    Dim Ent As AcadEntity
    'get the BlockReference
    ThisDrawing.Utility.GetEntity oBref, Pt, "Pick a block reference:"
'Use the BlockReference's name to find the block definition
    Set B = ThisDrawing.Blocks(oBref.Name)
'Cycle through the entities in the block
    For Each Ent In B
      If TypeOf Ent Is AcadCircle Then
'Store the circle in an object variable
            Set C = Ent
            Exit For
      End If
    Next Ent
      
    Dim L As AcadLine
    ThisDrawing.Utility.GetEntity L, Pt, "Pick a line:"
    L.Move oBref.InsertionPoint, B.Origin
    Pt = L.EndPoint
    'circle formula x^2+y^2=radius^2
    X = Sqr(C.radius ^ 2 - Pt(1) ^ 2)
    If Pt(0) < 0 Then X = -X
    Debug.Print Pt(0), X
    If Abs(Pt(0) - X) < 0.00000001 Then
      MsgBox "The line ends on the circle."
    End If
    L.Move B.Origin, oBref.InsertionPoint
   
End Sub
现在,如果拾取的块引用的旋转为零,法线值为(0,0,1)
则圆&#039;s中心;块参考与块参考插入点的距离和方向相同,因为块圆中心与块#039;s原点

Kerry 发表于 2007-10-10 02:25:08

谢谢Bryco和Kerry
这很有帮助。。
页: 1 [2]
查看完整版本: 如何获取块中的所有数据?