我将把您交给我们当中的VB用户的好帮手……
但是如果您发布您使用的块,并发布您迄今为止尝试过的一些代码,可能会很有帮助
您是否正在尝试完全编程的解决方案
每个区块的规则是什么
您知道如何在VBA中选择块插入吗
您知道如何从块表/集合中检索块定义吗
您知道如何遍历集合吗
您知道如何从块中检索X、X、Z比例吗
克里,
谢谢你给我的问题和回应...它帮助我对我们的问题有所了解。
最后,关于你给我的第二个问题,
比如,“你知道如何从块表/集合中检索块定义吗?
如何从块表/集合中检索块定义??任何想法??
再次感谢..
类似于的东西怎么样;
Dim theBlock As AcadBlock
Set theBlock = ThisDrawing.Blocks.Item("WhateverBlockNameYouWant")
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
现在,如果您选择的Block引用的旋转为零,法线值为(0,0,1)
那么Block引用中的圆心将与Block引用InsertionPoint的距离和方向相同,因为块圆心距离块的原点。
谢谢布里科和凯瑞...
这很有帮助..
页:
1
[2]