Jump to content

CT scan randomly sees 1 Material or 2 Materials


---
 Share

Recommended Posts

   #MCAD_ELEMENT=gom.script.sys.polygonize_volume (
       #elements=[gom.app.project.actual_elements[Volume_Name]], 
       #material_gray_values=['Background', ['Material 1', 'used']], 
       #polygonization_mode='all_surfaces')

    MCAD_ELEMENT=gom.script.sys.polygonize_volume (
        elements=[gom.app.project.actual_elements[Volume_Name]], 
        material_gray_values=['Background', ['Material 1', 'unused'], ['Material 2', 'used']], 
        polygonization_mode='all_surfaces')

 

Is anyone familiar with the python script above?  We use it after we capture a volume on the CT. The CT used to see two materials now it is randomly seeing 1 and 2 materials. 

If the above script runs expecting to see 2 materials and it only captures 1 material we get bad meshes. I need a solution or the ability to run an if statement to switch b/w the commented code with 1 material and the uncommented code with 2 materials.....I don't know how to get a variable from GOM that tells me beforehand how many materials it has seen.

Thanks for any help

Link to comment
Share on other sites

Hi,

in GOM Volume Inspect 2022 there exists a scripting command

"sys.determine_volume_material_gray_values"

that yields the values of automatically detected materials.
This could help to identify whether 1 or 2 materials where detected and an if-statement could be used to select one of the polygonization commands from your example code.

Best,

Lorenz

Edited
Link to comment
Share on other sites

Please sign in to view this username.

That is music to my ears my friend, thank you very much for that info. I'll be able to eliminate perhaps all our bad scans once we go to 2022 using an if stmt.

Thanks!

Link to comment
Share on other sites

Please sign in to view this username.

Other than just putting this text on a line in Python what would I need to write or put in parenthesis to retrieve the variable from that sub-program or module?

 

Thanks.

Link to comment
Share on other sites

  • 4 weeks later...

Please sign in to view this username.

Do you have an example of how to use the grey value command:

"sys.determine_volume_material_gray_values"

Is it x = sys.determine_volume_material_gray_values or something like that, does it report back a python list or something? I'd like to have a better understanding as I may try to convince the others to update one CT computer to 2022 this week. This functionality could really help us out greatly.

Thanks.

Link to comment
Share on other sites

Please sign in to view this username.

I think I have it figured out the python code would look like this:

gray_values = gom.script.sys.determine_volume_material_gray_values()

materials_seen =  len(gray_values)

Link to comment
Share on other sites

 Share

×
×
  • Create New...