[Closed] Unknown property: "Edit_Poly" error
A problem that has always bothered newbies, I want to use maxscript to give different compositematerial basematerial:(standard diffuse:(color 150 255 150)) to triangles and compositematerial basematerial:(standard diffuse:(color 150 150 255))pentagons in an obj file. But when I convert it to a mesh object, the listener says: Unknown property: “Edit_Poly” in $Editable_Mesh: 4^3 -3-3-3^^4 obj @ [0.000000, 0.000000, 0.000000]. How do I solve it? Thank you for your answer.
obj_files = getFiles “*.obj”
for f in obj_files do
(
–import file
if ( doesfileexist f ) do
importFile f #noPrompt using:Wavefront_Object
objfilename = getFilenameFile f
for geo in geometry
where ((geo.name == objfilename) or (matchPattern geo.name pattern:"3D_Object*") or (matchPattern geo.name pattern:"default*") or (matchPattern geo.name pattern:"*_obj")) do
(
--geo.name = (f as string)
pathaa = filterString (f as string) "\\"
geo.name = pathaa[pathaa.count]
geo.colorByLayer = false
geo.pivot = [0,0,0]
addModifier geo (unwrap_UVW())
convertToMesh geo
format "Object Name : % | Class : %" (geo.name) (classof geo)
num2 = geo.NumFaces --integer
triangleMaterial = compositematerial basematerial:(standard diffuse:(color 150 255 150))
pentagonMaterial = compositematerial basematerial:(standard diffuse:(color 150 150 255))
-- Loop through all faces in the geometry
for i = 1 to num2 do
(
if (geo.Edit_Poly.getFaceDegree i) == 3 then
(
-- Select the triangle face and assign the triangle material
geo.Edit_Poly.SelectFaces #{i}
geo.Edit_Poly.SetFaceMaterial triangleMaterial
geo.Edit_Poly.SetFaceColor (color 0 0 0)
)
if (geo.Edit_Poly.getFaceDegree i) == 5 then
(
-- Select the pentagon face and assign the pentagon material
geo.Edit_Poly.SelectFaces #{i}
geo.Edit_Poly.SetFaceMaterial pentagonMaterial
geo.Edit_Poly.SetFaceColor (color 0 0 0)
)
)
)
)
geo will be of type editable mesh after
convertToMesh geo
so you’d need to use editable mesh methods otherwise use
convertToPoly geo
though you won’t need the
Edit_Poly.
part in the rest of the code