コード例 #1
0
        public static IBody2[] SplitBodies(IModeler modeler, IBody2 body, SampleMacroFeatureDataBase database)
        {
            var box    = body.GetBodyBoxTs();
            var center = box.Center;
            var axisX  = Vector3.UnitX;

            // Find the point to cut the object
            center.X = (double)(database.Alpha * box.P0.X + (1 - database.Alpha) * box.P1.X);
            var sheet = modeler.CreateSheet(center, axisX, box.MaxDim * 2);

            var cutResult = body.Cut(sheet);

            return(cutResult.Error == 0 ? cutResult.Bodies : null);
        }