View Full Version : Calling a modeler plugin in Lscript

Paul Brunson
01-25-2008, 10:28 AM
I've seen something like this mentioned in some other threads but I must admit I'm too novice at scripting to fully understand. So I'll ask directly and hopefully someone can assist.

I'm trying to use Lscript right now to create macros. Very basic stuff, right now I'm working on a little script that simply merges points, scales by a set amount, rotates a certain amount of degrees and centers the object.

The problem I'm running into is rather than "center" I would like to call the "RestOnGround" plugin. However since that is a plugin not a native modeler command I'm stuck and don't know how to proceed.

I've seen mention of "applyserver" but I'm not sure how to use it, its seems I need to find the actual name of the "RestOnGround" plugin or something.

Anyway, I'd appreciate any pointers on calling or running a plugin through lscript.

01-25-2008, 03:16 PM
Only Layout uses "servers".

You can call a plugin, unfortunately though LWs architecture doesn't allow you to send any arguments to it. But in any case...

Do this. Search your computer for "lwext*.cfg". This file contains a record of all the plugins installed into LW. Once you've found it, open it up in a texteditor. Do a search for "ground" and keep repeating the search until you find the right entry. When you have, make a note that RestOnGround is a meshdataedit plugin and that it's internal name is "Rest-On-Ground".

To call a meshdataedit plugin you use the meshedit() function and provide the internal name as argument, as such:


More on calling plugins:

01-25-2008, 03:22 PM
Forget about the second link. It's for sdk/plugins.

Paul Brunson
01-30-2008, 09:28 PM
Thanks for the help, sorry I'm slow in getting back to you. I appreciate the help.

Now I'm running into an interesting problem. The script calls the plugin, the plugin interface comes up in Lightwave. I set the settings for the plugin, click ok and get this error. "You'll need some polygons for this operation to work!"

The funny thing is if I immediately after the error run the "Rest on Ground" plugin by itself it works. Here is my script code:

//Preprocessor Compiler Directives
@script modeler
@name "MergeScaleRotateCenter"
@version 2.3


Any Ideas on what I'm missing?

01-31-2008, 10:44 AM
It seem like this only happens if you have multiple layers in the foreground with some polygons selected in layers which are not the first layer. Very likely Rest-On-Ground just doesn't support multiple layers and only works on the first layer. Usually nothing selected means everything is selected, but with something selected in layer 2, this rule is outplayed, and it will consider nothing to be selected in layer 1. So Rest on ground reports nothing selected.

If you want your script to work on multiple layers you'll probably need to select each layer in turn and run rest on ground once for each. Then restore the initial layer selection (if you care about workflow).