本帖最后由 qq116359910qq 于 2017-7-25 10:22 编辑
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
请教下如何修改才能将上面这个宏改成可以在product下使用并且只转化点而不是转化所有几何图形集下的东西变成球?
|