[Python] Projected surface area of CatiaV5 part (Using silhouette)

Discussão em 'Python' iniciado por Stack, Junho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I've been trying to figure out how to access silhouettes for CatiaV5 (GSD) API in python for a few days now but i've not been able to figure it out (To extract the projected surface area of a solid part). I tried different approaches and the only one that worked was UI implementation which is slow, ugly and very error prone. There is no hybridshape option for silhouettes at all from what i've found?

    I did find the silhouette (collection) in the official documentation [https://catiadesign.org/_doc/V5Automation/] But i've not been able to figure out how to actually use it.

    This is the latest atempt, the spaworkbench has been working for me to add other implementations like inertia so expected it to be able to add silhouettes aswell but it appears not. (Alternatively is there another approach i could use that does not use silhouette operation directly for the same result?)

    import win32com.client

    catia = win32com.client.Dispatch("CATIA.Application")
    catia.Visible = True
    doc = catia.ActiveDocument

    product = doc.Part
    gsd_workbench = doc.GetWorkbench("SPAWorkbench")
    silhouettes = gsd_workbench.Silhouettes
    silhouettes.Add("--Insert parameters for new silhouette--")

    Output:
    -silhouettes = gsd_workbench.Silhouettes)-
    raise AttributeError(f"{self._username_}.{attr}")


    Example of silhouette operation

    Continue reading...

Compartilhe esta Página