Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python mxs Classof

def get_all_mats(model):
    materials = []
    dupe = rt.copy(model)
    rt.resetXForm(dupe)
    rt.collapseStack(dupe)
    material = dupe.material
    if rt.classOf(material) == rt.Multimaterial:
        for matID in xrange(material.numsubs):
            #see if we can select any faces for each material
            dupe.selectByMaterial(matID+1)
            faces = dupe.GetSelection(rt.name("Face"))
            numSelected = faces.numberset
            if numSelected > 0:
                materials.append({material[matID]: numSelected})
    elif rt.classOf(material) == rt.StandardMaterial:
        # if we only have one material we assume that it is on every face
        materials.append({material.name: dupe.mesh.numFaces})
    rt.delete(dupe)
    return materials
Comment

PREVIOUS NEXT
Code Example
Python :: p0, percent, aug (inhabitants coming or leaving each year), p (population to surpass) 
Python :: Open S3 object as string in Python 3 
Python :: else clause in for loop python 
Python :: how to split a string every 2 characters python 
Python :: check if string is palindrome using recursion in python 
Python :: NumPy bitwise_xor Code When inputs are numbers 
Python :: NumPy unpackbits Code Unpacked array along default axis 
Python :: django view - APIView (urls.py config) 
Python :: save axis and insert later 
Python :: # convert dictionary keys to a list 
Python :: pandas cleaning dataframe regex 
Python :: first index of an integer less than a value 
Python :: call a Python range() using range(start, stop) 
Python :: text to speech free python 
Python :: python tkinter.ttk combobox down event on mouseclick 
Python :: List change after copy Python 
Python :: pixel accuracy image segmentation python 
Python :: how to loop 10 times in python 
Python :: python 3.9.7 
Python :: Deploying matlab app on the web using python 
Python :: Python 3 (python 3.7.3) sample 
Python :: python request.args.get list 
Python :: ring convert string lines to list items and convert the list to a string 
Python :: candelstick chart matplotlib 
Python :: plot a list of number in python 
Python :: SimpleITK interpolation 
Python :: python getpass save file 
Python :: attribute error rest framework 
Python :: python class overwrite length method 
Python :: scrollable dataframe 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =