hexagon logo

How to create multiple groups by material name using PCL?

How to create multiple groups by material name using PCL?
Parents
  • Use the shareware utility, but I assume you want this as pure PCL (not interactive) so you will need to find all the material IDs so something like this may guide you:
    INTEGER nmats
    INTEGER imats(virtual)
    STRING mats[32](virtual)
    INTEGER status,i
    INTEGER i_id, i_cat, i_lin, i_dir, i_type
     
    db_count_materials(nmats)
    sys_allocate_array(imats,1,nmats)
    sys_allocate_array(mats,1,nmats)
     
    $ Get all the all the material names from the database
    $ uses a looping while .... get_next... structure
    status = db_get_all_material_names ( )
    if (status != 0 ) THEN return
    $ Get all material information from the database
    $  only keep the mat name and id
    i=0
    WHILE ( status == 0 )
      i+=1
      status=db_get_next_material_name(mats(i), i_id, i_cat, i_lin, i_dir, i_type )  
    $ Get material ID from name  
      status = db_get_material_id_from_name (mats(i), imats(i))
    END WHILE
     
    $call the shareware PCL function to make the groups
    au_create_group_by_material.main2( nmats, mats, TRUE, "All", "", 0, @
                ["empty"], "Multiple Groups", "", "type", "matl." )
Reply
  • Use the shareware utility, but I assume you want this as pure PCL (not interactive) so you will need to find all the material IDs so something like this may guide you:
    INTEGER nmats
    INTEGER imats(virtual)
    STRING mats[32](virtual)
    INTEGER status,i
    INTEGER i_id, i_cat, i_lin, i_dir, i_type
     
    db_count_materials(nmats)
    sys_allocate_array(imats,1,nmats)
    sys_allocate_array(mats,1,nmats)
     
    $ Get all the all the material names from the database
    $ uses a looping while .... get_next... structure
    status = db_get_all_material_names ( )
    if (status != 0 ) THEN return
    $ Get all material information from the database
    $  only keep the mat name and id
    i=0
    WHILE ( status == 0 )
      i+=1
      status=db_get_next_material_name(mats(i), i_id, i_cat, i_lin, i_dir, i_type )  
    $ Get material ID from name  
      status = db_get_material_id_from_name (mats(i), imats(i))
    END WHILE
     
    $call the shareware PCL function to make the groups
    au_create_group_by_material.main2( nmats, mats, TRUE, "All", "", 0, @
                ["empty"], "Multiple Groups", "", "type", "matl." )
Children
No Data