ScriptSpot

Script

Mesh Surface

By Swordslayer · Credited author: Vojtech Cada · 2016-06-26

Version
0.02a
Version requirement
3ds Max 9
Votes
21
Description

Creates surface defined by four splines. The order of picking the splines matters - they should form a closed loop. If you get a weird looking mesh, try once again starting with another of the four splines:

Note that if any of the splines are animated, the resulting mesh is animated, too.

Additional Info

Installation:

Copy the .ms file to your scripts\startup folder or run as a script if you only want to try it out. The object primitive will be available under Examples in the Create panel.

There's also an additional .mcr file - after you've installed the .ms file, it's enough to run the .mcr file once. It creates a Make Surface From Selection item in the Shortcuts category under Customize UI, which you can then add to a quadmenu or assign a shortcut to it (that's what I'm showing in the preview gif). To use it, select the four individual splines in a circular manner (counter-clockwise is preffered but will work with either - you can always flip normals) and press the button/keyboard shortcut.

Attachments

Tags: spline, primitive, surface, mesh

Comments (28)

.mcr Error

dreamerdreamers · 2018-09-15

Hi Swordslayer,

Thanks for this great script!
I got this error everytime i'm using the toolbar button/keyboard shortcut

-- MAXScript MacroScript Error Exception:
-- Type error: Call needs function or class, got: undefined
-- MAXScript callstack:
-- thread data: threadID:7316
-- ------------------------------------------------------
-- [stack level: 0]
-- In codeblock macroScript: Shortcuts_meshSurfaceFromSelection; filename: C:\Users\(USERNAME)\AppData\Local\Autodesk\3dsMax\2018 - 64bit\ENU\usermacros\Shortcuts-meshSurfaceFromSelection.mcr; position: 256; line: 8
-- Locals:
-- meshSurface: undefined
-- Externals:
-- ------------------------------------------------------
-- [stack level: 1]
-- called from top-level

i already put the .ms file in scripts/startup folder, at first the macro works, but it stopped working after i restart 3ds max, any idea what's wrong?

Swordslayer · 2019-08-03

Should be fixed now.

lwan · 2018-06-14

Now this may be just an exercice script but... Surface modifier in max does just that since over 15 years and is not limited to 4 splines but any 'mesh' of splines with 3 or 4 'sides'

Different usecases for each

Swordslayer · 2018-06-14

As you can see on the demo gif, the number of knots of each spline doesn't matter (note the knot in the middle of the top spline) which is not the case with Surface modifier - there, you're limited to single-segment pieces. All the splines have to be attached, too, and you cannot separately set different subdivisions in each direction - which comes in handy especially with thin strips where you want more subdivs along the long sides and less along the short ones. Last but not least, a source code is provided so if you want to adapt it to your specific needs, nothing prevents you from doing so (or paying someone to do that for you).

Oh, and you don't have to add a TurnToMesh to see the mesh representation, it's already a mesh.

xiaozhao · 2018-05-26

Friends can now be reused, but there is a small problem. Every time you use it, you need to drag the plugin back into the interface. I want to be able to modify it. You don't have to manually install it every time you start it.

Swordslayer · 2018-05-27

No you don't have to do that at all, did you read the Installation part?

xiaozhao · 2018-05-28

Not friends, this is not enough. I have tested several times. I used the 2016 version. I also followed the installation method suggested by you. The result is that each time you start the software, you must pull these two files back into the software to start this. Plugin

EliderDeli · 2018-05-28

Thank you very much I will do that :)

Swordslayer · 2018-05-13

The problem after reopening saved file should be fixed now.
@PV3D: I don't see any issue when running in max 2019, could you be more specific?

EliderDeli · 2018-05-18

Great Thank you very much

EliderDeli · 2018-05-18

I like your Script a lot but Im struggeling with understanding the code.
If u have time I would love to get a short step by step iteration through the math behind (or some reading tipps)
What exactly does the ed01 do (didnt find Inofs in the maxscript SDK)
Greetings and Thanks in Advance

Swordslayer · 2018-05-22

EliderDeli: There's no ed01 anywhere in the code...

EliderDeli · 2018-05-24

Sorry for that I meant -> 1d0
Any reading advices for the math behind the script
Thank u in advance
Greetings EliDerDeli

xiaozhao · 2018-05-09

I believe this is a great plugin that greatly improves the efficiency of the work. But can it be improved that this plugin can only run once in the window? ? Turn off the software and turn it on again and you can't use it. Really hope to improve this problem. Thanks

Max Version update

PV3D · 2018-05-09

Great script which I use a lot. Will there be a version for Max 2019?

EDIT: My bad. I have it working now, for some reason Max 2019 wasn't loading the script at startup.

Thanks

Problem after save and reopen

EliderDeli · 2018-04-18

First Thanks for your great Script. Im using 3ds Max 2018 and when I save and close and reopen a file alle MeshDatas are lost (only a staple of trinagles at 0,0,0 Worl Position is there).

Thank you very much, great script

vlada021 · 2016-10-11

Thank you very much, this is a life saver.

I didn't know how to use it at first, since tool was shut down each time I selected pick spline, so I will explain how I use it now, if anyone else has the same problem.

- create 4 splines that will define desired surface
- go to create/geometry/ examples
- click on mesh surface button and make one mesh by clicking anywhere on the scene
- select that mesh, go to modify
- then select 4 splines as described, by clicking select spline for each spline and select them in order so that they form a loop, as we can see on animated gif
- selected mesh will transform into a mesh that follows the splines

Thank you again, this is great script

Sincerely,
Vlada

Swordslayer · 2016-10-11

Glad that you like it. That's one way of using it, and because it's not really intuitive, I've made the macroscript to simplify that a bit. Once you run the .mcr file (one-time operation only), it will make a new item available in Customize UI dialog and you can bind it to a shortcut, quadmenu/menu item or toolbar button. After that, it's enough to select the splines in the right order and run it.

I want to Help for Mesh Surface script Install

razib082 · 2016-09-28

Its must be helpful tools, but i couldn't installed it, i have used 3d max 13,

Swordslayer · 2016-09-29

There's both a script, how to install and use it is explained for example here. And there's also a macroscript file - mcr. That one is used to make a shortcut in quadmenu, menu, on a toolbar etc. and it's enough to drop the the viewport once and it should appear in the Shortcuts category (you will find it in the Customize UI dialog).

Both files are needed

Swordslayer · 2016-07-21

The meshSurface.ms file must be installed first, the macroscript is just the shortcut to use that, nothing else. That means, copy the file to your scripts/startup folder (so that it will work out of the box after starting a new max instance) - and if you want to avoid having to restart max for it to take effect, run the .ms script once. After that, the macroscript will work as expected.

If you are unsure where to find the scripts/startup folder, run this command in maxscript listener:

shellLaunch (getdir #scripts + "\Startup") ""

error using script

vikirecon · 2016-07-22

thanks it worked

it would be great if it worked with more than 4 splines but nonetheless its great script helped my work very much thanks again

error using script

vikirecon · 2016-07-16

hi swordslayer,

my first post so please bear with me, when i use script it gave me this error (class needs function got undefined ).i dont know what a am doing wrong. please help me and thanks for your wonderful script.

Have a screenshot?

Swordslayer · 2016-07-18

I'd need the full stack trace to tell you what's wrong, what function, what are the values etc.

error using script

vikirecon · 2016-07-19

hi sword slayer thanks for the reply ,i hope this is what you ewre asking thanks.

-- Error occurred in anonymous codeblock; filename: C:\Users\viki\AppData\Local\Autodesk\3dsMaxDesign\2015 - 64bit\ENU\usermacros\Shortcuts-meshSurfaceFromSelection.mcr; position: 255; line: 8
-- Frame:
-- meshSurface: undefined
>> MAXScript MacroScript Error Exception:
-- Type error: Call needs function or class, got: undefined <<

Attachments

...+1

barigazy · 2016-06-27

Another amazing tool. Thanks for sharing this.
Cheers!

fajar · 2016-06-26

Thanks