Skip to content

[BUG] COG Computation of CATProduct #283

@Morpheus5828

Description

@Morpheus5828
from pycatia import catia
from pycatia.product_structure_interfaces.product import Product
from pycatia.product_structure_interfaces.product_document import ProductDocument

if __name__ == "__main__":


    caa = catia()
    documents: ProductDocument = caa.active_document
    product_document = ProductDocument(documents.com_object)
    root_product = Product(product_document.product.com_object)
    
    inertia = root_product.get_technological_object("Inertia")
    
    print(inertia.GetInertiaMatrix())

Hi
I ve got a tree which contains different CATProduct and i wish to get COG matrix from the first one.

  • Root node

  • CATProduct1
    -CatProduct2
    -CatProduct n
    -CatPart1

    File "C:\Users\Desktop\MacroApp\macro\macro_thomas.py", line 31, in
    print(inertia.GetInertiaMatrix())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "", line 2, in GetInertiaMatrix
    File "C:\Users\AppData\Roaming\Python\Python312\site-packages\win32com\client\dynamic.py", line 356, in ApplyTypes
    result = self.oleobj.InvokeTypes(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    pywintypes.com_error: (-2147352567, 'Une exception s’est produite.', (0, 'CATIAInertia', 'La méthode GetInertiaMatrix a échoué', None, 0, -2147467259), None)

I have this error ... with catia i can click on Mesure Inertia button and have the result.
Best regards

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions