How to split a cylinder say 10 times?

Erik Kostson
Erik Kostson Member, Moderator, Employee Posts: 312
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited February 17 in 3D Design

Is there a way using scripting say to automatically split a cylinder along a direction say 10 times?

Answers

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 312
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited February 17

    Below is one possible way of doing this:

    # Python Script, API Version = V242
    
    # Create Datum Plane
    selection = FaceSelection.Create(GetRootPart().Bodies[0].Faces[1]) # base plane to use for split
    result = DatumPlaneCreator.Create(selection, False, None)
    # EndBlock
    
    for ii in range(1,11,1):
    
        # Translate Along Z Handle
        selection = Selection.Create(GetRootPart().DatumPlanes[0])
        direction = Move.GetDirection(selection)
        options = MoveOptions()
        result = Move.Translate(selection, direction, MM(-100), options) # change as needed
        # EndBlock
    
        # Slice Bodies by Plane
        selection = BodySelection.Create(GetRootPart().Bodies[ii-1])
        datum = Selection.Create(GetRootPart().DatumPlanes[0])
        result = SplitBody.ByCutter(selection, datum)
        # EndBlock
    
This discussion has been closed.