select geometry with any kind of mesh

I exhausted all possibilities after one day I'm out of ideas how to solve it, here is my problem:

I have to count all polygones in selection so I have to get to every object with mesh and here is a problem.
I noticed 3dsmax geometrysuperclass is also particle systems, mr proxy and other objects which have no mesh.
I can't define it by class because there is so many classes to predict.
So I created filter to exclude particle systems at least but it seems no matter what I do PF_Source stay always in selection.

Is it way to select geometry objects only with mesh, any kind of mesh, poly, mesh, primitive?

This is my code but not work with pf_source and different not-mesh geometry object, I already checked it on massive scene.
Can somebody take a look on this.I would be thankful.

polygonesc=0
myArray = #()

----this is first firewall to exclude particle but not work for PF_Source
select(for o in selection where classOf o != VRayProxy and classOf o != Snow and classOf o != PF_Source and classOf o != PArray and classOf o != SuperSpray and classOf o != Spray and classOf o != Blizzard and classOf o != Blizzard and classOf o != PCloud collect o)

----this is second firewall to exclude particle but not work for PF_Source
for t in selection do
(
tr=classof t
if tr==PF_Source then deselect t
)

for o in selection where superclassof o == geometryClass do

(

addmodifier o (Edit_Poly ())
myPolyCount = polyop.getNumFaces o
append myArray o
polygonesc=polygonesc+myPolyCount
deleteModifier o 1
)

select myArray

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kredka's picture

Ok you got me

I wish to be a such a beginner like You or Rodman, I think, with my congenital skills for programming it will take me a while. I get always 1(F) from mathematics and physics:) I used to program on Amiga Amos but it was way more easier and way more limited. Thanks to you I have solution for problems I stuck for good, another words some times you are my only help.

Rodman's picture

I wasn't blaming you. Just

I wasn't blaming you. Just kidding a bit. It's more an advice, your best friend for Maxscript is the official documentation, then you have google, forums, programmers page, etc. You have to start little, try new stuff little by little. You got an answer from Miauu and Barigazy, i think they master pretty well Maxscript. So you have few chance to be right if you say they are wrong to them.

Keep trying and impress all of us here ! I'm self-educated about programming. I learned all by myself. I was lost like you but I kept trying and now I feel comfortable and I'm happy that people like Barigazy are sharing their knowledge.

Rodman

miauu's picture

.

Totally agree with Rodman, except that I still consider myself as maxscript beginner.
When I started with maxscript I asked a friend of mine, known in this forum as Anubis - how he knows so much about maxscript? His answer was - Learn to read the Help file. And he was right. Help file + forums + patience is the answer.
Branko is right about the math. For me most important is the ability to have the proper logic when you builds the algorithms. If you know how the things must happen(step by step), then it is easier to write the script.

barigazy's picture

...

Thanks for kind words :)
We (mxs scripters) are not here only to help someone but also to learn something new and have some fun. Also people that you will meet here or any other forums related to programming are very king, talented and good at their jobs.
If we don't share our knowledge with each other these forums would not exist.

barigazy

barigazy's picture

...

Cheer up buddy, I don't know about Rodman but I'm not programmer. Only if you dealing with heavy calculations then you need to know the math and physics. Everything else is pretty much reading and testing.
If you ask Kostadin about mxs then he give you probably the same answer :)

barigazy

kredka's picture

work

thx it works. Rodman I'm very begginer but I have to complete big task and for you guys it's piece of cake but for somebody who is new, some stuffs are even hard to interpret from maxscript help.

barigazy's picture

...

Come on kredka, don't complain now. :)
We are all begginers here O_o ...
... except Rodman ;)

barigazy

kredka's picture

Don't work

No ""canConvertTo"" function for Editable_mesh

sory it won't work this way:(

barigazy's picture

...

Sometimes you need to look by yourself to fix the code
Everyone makes mistake when post fast answers

for o in geometry where (isKindOf o GeometryClass and canConvertTo o Editable_Mesh) collect o

barigazy

Rodman's picture

***

We should give him the page of the Maxscript documentation. :D

Rodman

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.