iCAx开思网
标题:
catia宏求助
[打印本页]
作者:
qq116359910qq
时间:
2017-7-12 18:24
标题:
catia宏求助
[attach]1250831[/attach] 如上附件是catia点转为球的宏,请教下如何编辑才能让其只转化piont而不是所有的点线面体等全部转化为球?另外这个宏只能在part下用,如何编辑才能在任何环境下用?
作者:
arvinliu
时间:
2017-7-14 09:42
每个piont都有相应的名字,如果你没有自己特意命名应该命名规则为piont1、piont2...那么你要哪个点转化成圆就得指定点的名字,这样才能精确的达到效果;另外宏在任何环境下需要进行一个Product和part环境判断,也就是不管前面是多少个装配,我最后作用到的是part,那么你就得具有一定的VB编程基础了。如果你是完全没基础的,这点功能对你来说还是挺困难的。
作者:
arvinliu
时间:
2017-7-14 09:44
另外,直接贴源码出来就行了,搞个附件还要下载
作者:
qq116359910qq
时间:
2017-7-25 10:09
Sub catmain()
Dim iSelection
Set iSelection = CATIA.ActiveDocument.Selection
Dim iStatus, iType(0)
iType(0) = "HybridBody"
iStatus = iSelection.SelectElement2(iType, "Please select the Geometrical Set with center points", False)
If iStatus = "Redo" Or iStatus = "Undo" Or iStatus = "Cancel" Then
Exit Sub
End If
Dim iName, iHB, sHB
iName = iSelection.Item(1).Value.Name
Set iHB = CATIA.ActiveDocument.Part.HybridBodies.Item(iName)
Set sHB = CATIA.ActiveDocument.Part.HybridBodies.Item(iName)
Dim iHSF, iPoint, iSphere, iRadius
iRadius = InputBox("Please input joint radius", "Joints Creation Tool", 10)
Set iHSF = CATIA.ActiveDocument.Part.HybridShapeFactory
For Each iPoint In iHB.HybridShapes
Set iSphere = iHSF.AddNewSphere(iPoint, Nothing, iRadius, -90, 90, -180, 180)
iSphere.Limitation = 1
sHB.AppendHybridShape iSphere
iSphere.Name = iPoint.Name & "_Joint"
Next
iSelection.Clear
CATIA.ActiveDocument.Part.Update
End Sub
补充一下宏,请大神指导~
欢迎光临 iCAx开思网 (https://www.icax.org/)
Powered by Discuz! X3.3