View Full Version : Copy/Paste/Save/Load Surface

06-02-2003, 01:44 PM
I need to apply a surface and all of its settings to a diffferent object.
Can LScript do any of these actions within the surface editor:
If so.....How.

Any help would be appriciated,,,,thanks,


06-02-2003, 02:05 PM
I found a copysurface() function, but it doesn't seem to work,
Anyone have this problem.
Also, Just for the fun of it I tried using renamesurface().
It renamed my surface to volume, then when I clicked on the surface and tried to manually rename it in the editor, It renamed it to cut.
Huh.....I tried renameing it to S1....how did I get these results.

Julius Caesar
08-09-2003, 02:54 AM
I was just looking for the same functions but I did not find any useful information. If we get this thread active may be soon or later somebody will tell us the magic word!!!


03-12-2004, 02:47 PM
Looks like there are even more surface-related bugs in LScript. For example, try this (I'm using LScript 2.6.1):

@version 2.4
@script modeler

newname = "Surface";
defsurf = getdefaultsurface();
info("Default surface: "+defsurf);
// #1 even if there isn't any surface in the Surface Editor, defsurf will be
// set, most likely to "Default", but then any operation on this surface
// will make the Modeler crash (for example the next one)

copysurface(defsurf, newname);
// #2 surface information isn't copied at all, does not matter if the new
// surface exists or not

renamesurface(defsurf, newname);
newsurf = getdefaultsurface();
info("New default surface: "+newsurf);
// #3 it does not matter the default surface has been renamed,
// getdefaultsurface() will return the old name

surf = Surface(newsurf);
if (!surf) info("Cannot find: "+newsurf);
// #4 of course, this surface does not exist, it has been renamed

04-04-2004, 05:55 PM
I don't know about LScript, but you can use the presets shelf to do it. Load your surface into the presets shelf by double clicking on the preview in Surface editor, open the surface you wan to apply it to and double click on the preview in the preset shelf to apply it.

Oh except that the preset shelf is broken on macs. So I just save the surface and load it back in.

12-20-2006, 05:07 AM
Sooo, does it work by now? Because, i sure as **** can't get it to work in LW9.0 and LW9.2
Would be really handy as i need to resurface a couple of 300 frame Realflow mesh exports.

A workaround would be importing all files into Modeler or Layout and doing a mass surface past copy, by setting the surface editor's 'Edit by' to Scene, but that somehow makes the preview renderer go ape-poop.
Also, Lightwave doesn't import more than 20 something files at once.

12-20-2006, 05:47 AM
I haven't been successful with copying and pasting surfaces, but loading and saving have been successful for me.

I have a function here (http://www.newtek.com/forums/showthread.php?t=58670) for getting the selected surface.

And loading a surface is accomplished by setting the surface you want to change...

CommandInput("Surf_SetSurf \"Your_Surface_Name_Here\" \"The_Object_Your_Surface_Is_On\"");
and using the load surface command...

CommandInput("Surf_Load \"C:\\exact\\path\\to\\your\\surface.srf\"");

12-20-2006, 07:46 AM
Jeremy, you're my hero :p
That works like a charm...

Do you know if there's a LScript function like ClearSelected(); (that as per Newtek style, is not documented) that allows for Object removal from a scene without the user having to press "Yes" (because right now i still have to press Yes as the loading all objects and then clearing the entire scene is too memory intensive)

12-20-2006, 07:55 AM
before you clear selected will supress it.
be sure to put it back to

so that the user can still get prompts after your script is run.

Also, if you're getting errors that you know aren't problems or info boxes that you don't want to stop the script, you can temporarily change the user's Alert level with:

//get the initial alert level
initial_alertlevel = Scene().alertlevel;

//change the alert level so that prompts and non-important errors
//only appear in the status bar
CommandInput("AlertLevel 2");

//change the alert level back to what it was initially
CommandInput("AlertLevel " + string(initial_alertlevel));