Print the Volume of a body from CATIA V5

6 Replies to “Print the Volume of a body from CATIA V5”

  1. Hi,
    I’m trying to get the center of gravity for a product by using this:

    a = doc.Analyze.GetGravityCenter

    But I only get the method of the object itself instead of the resulting x,y,z.
    Do you know how to make this work?

    Best regards

  2. I`m not sure, but perhaps GetGravityCenter is a Method? I would try:

    a = doc.Analyze.GetGravityCenter()

    Then I would expect the value of “a” as a tuple. Something like (100, 22.32, 98.12).

  3. Yeah, it’s a method and I agree with you that the expected value of “a” would be a tuple.
    I think the problem is that the method GetGravityCenter() in Catia needs an array variant as an argument (CATSafeArrayVariant oGravityCenterCoordinatesArray) to store the CoG values. I have run makepy in win32com and it generates the following function:

    def GetGravityCenter(self, oGravityCenterCoordinatesArray=defaultNamedNotOptArg):
    return self._ApplyTypes_(1610940419, 1, (24, 0), ((8204, 3),), ‘GetGravityCenter’, None,oGravityCenterCoordinatesArray)

    From what I have read the (24, 0) means the function returns “void” and (8204, 3) means the parameter is an IN/OUT parameter that is an array of variants.

    However, when trying to include anything (list, string, etc.) as a parameter to the method in Python it only returns the inputed argument…

    Any suggestion to get around this?

      1. Hi Mustafa,

        do you have any information on the state of the issue above? I’m running into the same problem described by Marcus, and it’s pretty much a deal-breaker for me if reading coordinates of CATIA objects become impossible. I could not find a working solution anywhere, very unfortunate :/.


        1. Hi Andreas,

          sorry, unfortunately not. But you could try comtypes, which is another Python module for MS COM. It works similar to pywin32. Perhaps you have luck…


Leave a Reply

Your email address will not be published. Required fields are marked *