Jump to content

How could I retrieve total number of connected primitives ..?


Masoud

Recommended Posts

25 minutes ago, Masoud said:

retrieve total number of connected primitives

i@islands = nuniqueval(0, 'prim', 'class');

 

26 minutes ago, Masoud said:

create a group for each connected primitive

int island = prim(0, 'class', @primnum);
string grp_name = 'island_' + itoa(island);
setprimgroup(0, grp_name, @primnum, 1, 'set');

 

group_islands.hiplc

  • Like 2
Link to comment
Share on other sites

1 hour ago, konstantin magnus said:

i@islands = nuniqueval(0, 'prim', 'class');

 


int island = prim(0, 'class', @primnum);
string grp_name = 'island_' + itoa(island);
setprimgroup(0, grp_name, @primnum, 1, 'set');

 

group_islands.hiplc

 

Thank you very much...

How could I iterate over connected primitives?

Edited by Masoud
Link to comment
Share on other sites

4 hours ago, Masoud said:

How could I iterate over connected primitives?

A combination of findattribvalcount() and findattribval() will get you there:

int vals = nuniqueval(0, 'prim', 'class');

for(int i = 0; i < vals; i++){
    int num = findattribvalcount(0, 'prim', 'class', i);
    for(int j = 0; j < num; j++){
       int pr = findattribval(0, 'prim', 'class', i, j);
       int some_value = i + j;
       setprimattrib(0, 'smth', pr, some_value, 'set');
    } 
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...