public static void SetManipulatorPositionToBodyCenter(ISldWorks sldWorks, TriadManipulatorTs manipulator, IBody2 body, IModelDoc2 model)
        {
            var box = body.GetBodyBoxTs();

            manipulator.Origin = (MathPoint)((IMathUtility)sldWorks.GetMathUtility()).CreatePoint(box.Center.ToDoubles());
            manipulator.UpdatePosition();
        }
コード例 #2
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);
        }
 public static void SetManipulatorPositionToBodyCenter(ISldWorks sldWorks, TriadManipulatorTs manipulator, IBody2 body, IModelDoc2 model)
 {
     var box = body.GetBodyBoxTs();
     manipulator.Origin = (MathPoint) ((IMathUtility) sldWorks.GetMathUtility()).CreatePoint(box.Center.ToDoubles());
     manipulator.UpdatePosition();
 }