AnsweredAssumed Answered

About API, how to use 'IBody2.Display3' to display the temporary body in drawing?

Question asked by Xihu Yellow on Jul 8, 2020
Latest reply on Jul 9, 2020 by Xihu Yellow

About API, how to use 'IBody2.Display3' to display the temporary body in drawing?

Where to display , document, sheet, view?

 

private int button_StartPicking_MouseMBtnDownNotify(int X, int Y, int WParam)
{
   Modeler swModeler = (Modeler)_SwApp.GetModeler();
   double[] dblData = new double[9];
   dblData[0] = 0;
   dblData[1] = 0;
   dblData[2] = 0;
   dblData[3] = 1;
   dblData[4] = 0;
   dblData[5] = 0;
   dblData[6] = 0.1;
   dblData[7] = 0.1;
   dblData[8] = 0.1;

 

   //Output body 1
   Body2 swBody = swModeler.CreateBodyFromBox3(dblData);
   object[] vEdges = swBody.GetEdges() as object[];
   object[] vFaces = swBody.GetFaces() as object[];

 

   // Test whether the loft body is a temporary body
   bool tempstatus = swBody.IsTemporaryBody();
   Debug.Print("Is the body a temporary body? " + tempstatus);


   if (tempstatus)
   {
      // Display the temporary body
      int display3status = swBody.Display3(currentDrawDoc, Color.FromArgb(255, 255, 0).ToArgb(),       (int)swTempBodySelectOptions_e.swTempBodySelectable);
      //0 = Success
      //1 = Failed because you did not get the body before using this method
      //2 = Invalid component
      //3 = Not a part instance
      Debug.Print("Temporary body displayed; examine the graphics area.");
   }
   else
   {
      Debug.Print("Temporary body was not created.");
   }

 

   Debug.Print("");

   return 1;
}

Outcomes