PDA

View Full Version : Can I automate 'Reduce Polys' in lcsript



Animotor
06-30-2010, 02:56 AM
Hi,

Is there a way to automate 'Reduce Polys' (Reduce-Polygons in reduce.plugin) in lscript? I finally managed to run it through meshedit() but it always prompts with the options window.

I'm trying to write a script that imports a set of files and optimizes them. It seems to be possible that the plug-in has been written in a way that its arguments cannot be set from outside. I wouldn't want to select the same settings for every selection in every file.

Is there another way to do this? The files I plan to modify with this script are OBJs created with Rhino.

Dodgy
06-30-2010, 06:26 PM
There's a scriptable version of qemloss, the BEST poly reduction tool for LW here:

http://amber.rc.arizona.edu/lw/qemloss3.html

I think it was written for doing batch processing so sounds like it's exactly what you're looking for.

Dodgy
06-30-2010, 06:36 PM
Double post

Animotor
07-01-2010, 08:00 AM
Oh, There is a OSX version after all. I actually found this plug-in earlier but somehow understood that it was Windows only.

Yeah, This is what I was looking for. Thank you very much.

Animotor
07-02-2010, 05:13 AM
OK, I found the plug-in and installed it. Actually I like the reduce.plugin more on this occasion but since it seems qemLOSS3 can be driven and reduce cannot, I'll be using it.

At the moment my problem is that when I run qemLOSS3s, it deletes all polygons. I must be doing something wrong. Could someone intruct? Also I'm not sure I'm using the weightmap correctly but If I set its value to zero, it still removes the polygons. I've tried to move the reduction command just after the weightmap-setting but the result is the same.


// create weightmap that highlights other vertices than those on edges
selpolygon(SET);
cmdseq("Select Outline");
selinvert();
editbegin();
myweightmap=VMap(VMWEIGHT,"weighty",1);
foreach(p,points)
{
myweightmap.setValue(p,1);
}
editend();

// Simplify the object per surface
surf = nextsurface();

while(true)
{
if((surf = nextsurface(surf)) == nil)
break;
// select surfaces for polygon reduction
selpolygon(SET,SURFACE,surf);
// simplify
cmdseq("qemLOSS3s","weihgty");
}

For some reason the qemLOSS3 deletes all the polygons leaving only points. I'm using LW 9.6 on OS X (10.5.8).

Castius
07-02-2010, 07:26 AM
could it be that "weihgty" is spelled wrong?
cmdseq("qemLOSS3s","weihgty");

Animotor
07-05-2010, 06:53 AM
Thank you for correcting my misspelling. But no, it didn't fix the problem.

UnCommonGrafx
07-05-2010, 07:54 AM
I'm looking at the page for the plugin and will ask a few questions that may help you clarify your situation.
- Are you running qemloss3s? Yup, that's what you said...
- Are you manually running qemloss3s once on an object in order for the settings cache to be set?
- Does the make weightmap function actually work for this purpose?

Animotor
07-06-2010, 01:24 AM
Yeah! The second one did the trick. I hadn't read the instructions thoroughly enough and thought that running the regular qemLOSS3 would set up the cache. Thank you for pointing this out.

It seems that if the plugin is started from the script without the weightmap parameter, it is considered to be run manually and the setup window opens. I think this will help me make the script more usable since I can script in the caching of settings and don't have to remember to do it all by hand first.

Too bad I can't script in the settings. If I understood the lscript manual correctly, it might be possible to set up some kind of a loop for trying out the settings but that might be too hard for me at this point.

Thank you once again for your help!