Language="VBSCRIPT"
Sub CATMain()
Dim WSShell
Set WSShell = CreateObject(“WScript.Shell”)
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Add()
hybridBody1.name = "geometrical set number 1"
part1.InWorkObject = hybridBody1
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Item("Absolute Axis System")
For i = 0 To 9
Set reference1 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(AxisSystem.1;2);None:();Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1)
Set reference2 = part1.CreateReferenceFromBRepName("REdge:(Edge:(Face:(Brp:(AxisSystem.1;3);None:();Cf11:());Face:(Brp:(AxisSystem.1;2);None:();Cf11:());None:(Limits1:();Limits2:());Cf11:());WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", axisSystem1)
Set hybridShapePlaneAngle1 = hybridShapeFactory1.AddNewPlaneAngle(reference1, reference2, i, False)
hybridShapePlaneAngle1.ProjectionMode = False
hybridBody1.AppendHybridShape hybridShapePlaneAngle1
part1.InWorkObject = hybridShapePlaneAngle1
Set ItemToRename =hybridShapePlaneAngle1
ItemToRename.Name ="plane" & i
Next
part1.Update
Set oSelection = CATIA.ActiveDocument.Selection
namer = Inputbox("First, please make sure that you activated the DSE licence for CATIA (Tools/Option/General/Shareable Products), then, Please enter the EXACT name of the Point Cloud you want to divide.")
oSelection.Search "Name=" & namer & "*,all"
Set oSelection2 = CATIA.ActiveDocument.Selection
For j = 0 To 9
CATIA.StartCommand "Planar Sections"
oSelection.Search "Name=" & namer & "*,all"
oSelection2.Search "Name=" & "plane" & j & "*,all"
For k = 0 to 14
'CATIA.RefreshDisplay = True
WSShell.SendKeys “c:FrmActivate”
WSShell.SendKeys “{TAB}”
Next
For k = 0 to 15
'CATIA.RefreshDisplay = True
WSShell.SendKeys “c:FrmActivate”
WSShell.SendKeys “{ENTER}”
Next
Next