0 Replies Latest reply on Jul 21, 2017 6:55 AM by Rahul Khande

    Issue with InsertMoveCopyBody2 ..

    Rahul Khande

      Hello,

       

      I have rectangle sketch. Then I extrude this rectangle sketch to form a solid bar.
      Later, I want to translate this bar at different location and also perform some more rotation operation.

      Inserting InsertMoveCopyBody2 and using MoveCopyBodyFeatureData , I'm able to translate but rotation doesn't work.

       

      Below is my code:

       

      swSketchMgr.InsertSketch(true);

      oPartDoc.ClearSelection2(true);

      oPartDoc.CreateLine2(SPoints[0].X, SPoints[0].Y, SPoints[0].Z, SPoints[1].X, SPoints[1].Y, SPoints[1].Z);

      oPartDoc.CreateLine2(SPoints[1].X, SPoints[1].Y, SPoints[1].Z, SPoints[2].X, SPoints[2].Y, SPoints[2].Z);

      oPartDoc.CreateLine2(SPoints[2].X, SPoints[2].Y, SPoints[2].Z, SPoints[3].X, SPoints[3].Y, SPoints[3].Z);

      oPartDoc.CreateLine2(SPoints[3].X, SPoints[3].Y, SPoints[3].Z, SPoints[0].X, SPoints[0].Y, SPoints[0].Z);

      FeatureManager swFeatureManager = (FeatureManager)oPartDoc.FeatureManager;

      Feature feature = swFeatureManager.FeatureExtrusion3(true, false, false, (int)swEndConditions_e.swEndCondThroughAll, 0, 5, 0.001, false, false, false, false,

                                     1.74532925199433E-02, 1.74532925199433E-02, false, false, false, false, true, true, true, (int)swStartConditions_e.swStartSketchPlane, 0, false);

       

      oPartDoc.ClearSelection2(true);

      oPartDoc.Extension.SelectByID("Boss-Extrude1", "SOLIDBODY", 0, 0, 0, false, 1, null);

      Feature fea = oPartDoc.FeatureManager.InsertMoveCopyBody2(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0);// Inserted move body - 1

      MoveCopyBodyFeatureData moveData = fea.GetDefinition();

      moveData.TransformType = 1;//(int)swMoveCopyBodyFeatureTransformType_e.swTransformType_Translation;

      moveData.TransformX = 2;

      moveData.TransformY = 2;

      moveData.TransformZ = 2;

      bool status = fea.ModifyDefinition(moveData, oPartDoc, null);

       

      status = oPartDoc.Extension.SelectByID("Body-Move/Copy1", "SOLIDBODY", 0, 0, 0, false, 1, null);// Select move body - 3

      fea = oPartDoc.FeatureManager.InsertMoveCopyBody2(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0);// Inserted move body - 4

      moveData = fea.GetDefinition();

      moveData.TransformType = (int)swMoveCopyBodyFeatureTransformType_e.swTransformType_Rotation;

      moveData.RotationOriginY = 45;

      status = fea.ModifyDefinition(moveData, oPartDoc, null);

       

      Movedefinition for rotate returns true but doesn't rotate the extruded feature.

       

      Can someone please help ?