我必须在两个部分之间移动一个类似球体的探针,以使探针与这两个部分接触。我必须找到零件的接触点,测量它们的距离并根据这个距离在零件上制作圆角。我已经实现了在零件之间移动球体,但球体正在穿过零件。所以试图相对于约束移动
我正在尝试自动化 Catia 产品中的操作工具。是否有任何命令或方法可以使用 vba 移动与 Catia 中的约束相关的零件?
或者
有没有办法使用 vba 找到两个部分之间的冲突?
期待解决方案。
谢谢!!!
这是一个链接,您可以在其中找到冲突的解决方案。
好的,我明白了,你想在这里查看代码 :-)
要在 CATScript 中计算碰撞:
Sub CATMain()
' get root product of document
Dim RootProd As Product
Set RootProd = CATIA.ActiveDocument.Product
' retrieve selection object of active document
Dim objSelection As Selection
Set objSelection = CATIA.ActiveDocument.Selection
' get two selected objects
If (objSelection.Count2 <> 2) Then
MsgBox "Before running the script you must select two products to compute clash for", vbOKOnly, "No products selected"
Exit Sub
End If
Dim FirstProd As Product
Dim SecondProd As Product
Set FirstProd = objSelection.Item2(1).Value
Set SecondProd = objSelection.Item2(2).Value
' create groups for clash computation
Dim objGroups As Groups
Set objGroups = RootProd.GetTechnologicalObject("Groups")
Dim grpFirst As Group
Dim grpSecond As Group
Set grpFirst = objGroups.Add()
Set grpSecond = objGroups.Add()
' add selected products to groups
grpFirst.AddExplicit FirstProd
grpSecond.AddExplicit SecondProd
' get access to Clashes collection
Dim objClashes As Clashes
Set objClashes = RootProd.GetTechnologicalObject("Clashes")
' create new clash
Dim newClash As Clash
Set newClash = objClashes.Add()
' set new clash to be computed between two groups (two selected products)
newClash.FirstGroup = grpFirst
newClash.SecondGroup = grpSecond
newClash.ComputationType = catClashComputationTypeBetweenTwo
' compute clash
newClash.Compute
End Sub