Partbrowser: Getting PartAssembly structure by script

Manuel Armbruester
Manuel Armbruester Altair Community Member
edited November 2021 in Community Q&A

Hello alls,

 

For setting up an automated process for PartBrowser, I have the need to extract the PartAssembly structure by script.

With these lines, I get all existing Part(assembly)IDs:

*createmark parts 1 all
set Part_List [hm_getmark parts 1]

But how can I identify:

- Which of the IDs is a Part and which a PartAssembly?

- How can I identify, which Parts/PartAssemblies are included in one specific Partassembly (for extracting the assembly structure)?

 

Thanks a lot

and

best regards

Manuel

 

Answers

  • Michal Stefuca_21473
    Michal Stefuca_21473
    Altair Employee
    edited November 2021

    Hi Manuel,

    You can do the following to get a list of Part Assemblies:

    # Select Part Assemblies
    *createmark parts 1 "equal to value" structural_type Assembly

    # Select occurences (filter out hidden prototypes)
    *createmark parts 2 "equal to value" config 2

    # Intersect the two selections
    *markintersection parts 1 parts 2

    # Get IDs of Part Assemblies
    set part_assem_list [ hm_getmark parts 1 ]

    In general, to check if a part/module entity is an assembly or a part, you can query the structural_type data name:

    hm_getvalue parts id=<part_id> dataname=structural_type

    To get the content of a Part Assembly, you can query the childrenids data name:

    hm_getvalue parts id=<part_id> dataname=childrenids

    This will return a list of IDs (those can be Parts or Part Assemblies if you have a nested structure). If it returns 0, it means the <part_id> is either a Part or an empty Part Assembly.

     

    Thanks,

    Michal Stefuca
    Program Manager – API and Customization Infrastructure at Altair

  • Hypermesh User
    Hypermesh User Altair Community Member
    edited November 2021

    Hi Manuel,

     

    I think you can use this Querry comand hm_allentitiesinfo to get the id of part in assemblies.

     

    This command will return the details in nested list.

     

    To check the command use below location,

     

    https://2019.help.altair.com/2019/hwd/topics/reference/hm/hm_allentitiesinfo.htm

     

    I think this will help you.

     

    Regards,

     

    Manoj Muthusamy