1 Reply Latest reply on Mar 31, 2015 9:35 AM by Keith Rice

    How to use IBody2::Operations2 in C# language?

    Fivezdw Fivezdw

      Hi, everyone

       

      I have encountered a problem using IBody2:: Operations2 method.

       

      Because I want to check the interference between two temporary bodies, I was suggested to use IBody2:: Operations2 method.

       

      I tried the IBody2:: Operations2 method, but there is some error. And I don't know how the three parameters should be assigned in C#.

       

      I checked the example in SolidWorks API help, but they are all written in Visual Basic.

       

      below is the code i used in C#.

       

      IBody2 tempBody = default(IBody2);

      IBody2 tempBodyTool = default(IBody2);

      tempBody.Operations2 ((int)swBodyOperationType_e.SWBODYADD, (IBody2)tempBodyTool, (int)swBodyOperationError_e.swBodyOperationNoIntersect);

       

      The two temporary body have already been created and assigned. (Codes not shown here)

       

      For the Operations2 method, an error occured saying there are some invalid arguments? but i cannot detect the error.

      it seems the problem comes from the first parameter (i.e. OperatioinType). I believe the first parameter should have an int type. But, SolidWorks API help, there are no indication of integer assignment for each operation type.

       

      i was wondering what is wrong with my codes.

      Hope that someone can help me with this problem.