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 |