PDA

View Full Version : Radial Move - Modeler LScript



falogfx
11-18-2011, 03:31 AM
Hi all!
After lurking this forum for years and almost never writing anything I'd like to give something back to the community.

This is a LScript I began to write in 2005, it sort of worked but probably not for anyone else but me. So a few weeks ago I needed it again and decided to update it a little. Now the script is hopefully a little more useful and I hope some of you may have some need and use for it.

The need for the script came when I needed to alter the diameter of a simple straight pipe and still keep the wall thickness. None of the standard tools did what I wanted. Stretch for example didn't keep the wall thickness and also was very hard to control for exact measures.

The simple task it performs is to move selected points in a radial manner from the center on selected planes. It can also move all point equally on all axis... Look at the pictures, they are explaining this better than my wording is :)

The script doesn't work (very well at least) on bent, rotated, curved objects.

I give this script to the community for free. Please copy it, give it to your friends, modify it to your liking but do not sell it for profit!

Post any bugs you find here, I'll try to fix them when I got some spare time. But don't expect too much.

Hope you like it, have fun :)

11-18-2011, 03:34 AM
This will be very useful! Thank you!

Fadlabi
11-18-2011, 03:58 AM
Thank you very much!

adhesiveX
11-18-2011, 06:32 AM
Thanks, very useful.

falogfx
11-18-2011, 09:33 AM
Glad to hear that, thanks!

tyrot
11-18-2011, 09:46 AM
thanks mate. .. indeed very useful

stiff paper
11-18-2011, 09:57 AM
Thank you.

raw-m
11-18-2011, 12:40 PM
Many thanks! Been looking for something like this for some morphs.

Afalk
11-18-2011, 03:09 PM
Excellent little tool! thanks for sharing it!

djwaterman
11-19-2011, 12:15 AM
That looks like a really useful thing that I never knew I needed.

Creativetone
11-19-2011, 02:23 PM
Thank you very much! :)

jeric_synergy
11-19-2011, 03:57 PM
That looks like a really useful thing that I never knew I needed.

Ha! What he said! Now that I see it, I know I need(ed) it!

íMucho gracias! :)

BigHache
11-19-2011, 04:47 PM
Awesome sauce! Thank you. I could have definitely used this and still have plenty of opportunities coming up.

falogfx
11-22-2011, 01:44 AM
Thanks for all your nice comments!
I just saw my little script is LightWave Plugin of the Week on liberty3d.com, I didn't see that one coming :)
http://www.liberty3d.com/2011/11/lightwave-plugin-of-the-week-radial-move/

Iain
11-22-2011, 02:20 AM
I just saw my little script is LightWave Plugin of the Week on liberty3d.com, I didn't see that one coming :)


I don't know why.
As a user of various CAD programs and other modellers, inadequacies like this have always drove me mad about LW (but it's still the most intuitive, enjoyable one to use of the lot!) :thumbsup:

atnreg
11-23-2011, 01:38 AM
WOW! Exactly what I have been looking for a LONG time!
Thank you VERY much!!!!

digefxgrp
11-24-2011, 12:55 AM
FINALLY!!!!!!:thumbsup:

lkolb
11-24-2011, 08:57 AM
Great work, thanks for your effort with this.

vector
11-24-2011, 09:52 AM
Thanks for sharing! Little tools that make the life easier :)

Vector

JeffrySG
11-26-2011, 04:48 PM
Very cool! Thanks!!

sellis
11-27-2011, 03:51 AM
Thank you. Very Cool.

ShadowMystic
11-29-2011, 05:45 PM
I used this today. An interactive slider would be nice but I'm just grateful for not having stretch effect my wall width.

falogfx
11-30-2011, 12:10 AM
I used this today. An interactive slider would be nice but I'm just grateful for not having stretch effect my wall width.

I agree and I actually thought about that while writing the script. However, I didn't find a good enough solution to set a slider range that would suite every need, without making an overly complex interface.
I really would like to make this a truly interactive plugin but I don't know how to code real plugins yet and LScript is quite limited when it comes to interactivity :(

jeric_synergy
11-30-2011, 12:03 PM
It seems there's a quantum jump in difficulty between the sort of "submit your order please" LScripts and real interactive LScripts.

Perhaps NTek has made available code examples?

At a deeper-than-LScript level, re LWCad, it's obviously possilbe, but then you're into a whole different language (C? C++?).

art
11-30-2011, 01:09 PM
It's not that difficult, just a bit more complex and requires more housekeeping (and its more or of a dirty trick than anything else) . The code I pasted below may be a good start. You may want to use a combination of undo commands instead of deletes when working on an existing geometry.
I learned quite a bit from interactive lscripts such as TazPipe (http://www10.dcccafe.com/link/display_detail.php?link_id=12900) and a few others I don't remember now. Unfortunately the speed of lscript is not great and for anything more than basic geometry and that also applies to interactive lscripts.

I wonder if python is any better and if it allows for interactivity at all. Every time I get excited about python I remember that python is tab delimited any my excitement dies..

//CODE BEGINS
var c1;
var scale = 1;

main
{
reqbegin("Example");

c1 = ctlpercent("Scale",scale);
ctlrefresh(c1,"refresh");
if(!reqpost()) return;
reqend();
}

refresh: val
{
unit = 1 * getvalue(c1);
delete();
makebox(<-unit,-unit,-unit>,<unit,unit,unit>);
}
//CODE ENDS

falogfx
11-30-2011, 03:06 PM
I think my script is as interactive as it gets for LScript. It uses the undo ctlrefresh trick just as Art mentioned. I suppose/hope you have noticed that it's possible to change the values while running the script!

You're all welcome to have a look at the code. The script is not compiled.

The best place I've found to search for this kind of hacks is actually the LScript parts of this forum. It has been a tremendous help lurking around here :) And of course I must mention Mike Green's LScript reference... can't live without it.

As jeric synergy suspects, to get real interactivity one would need to code the whole thing in C or eventually C++. I have a little experience in C++, so maybe some day.

I hope Python will allow us scripters some more control over things than LScript does. Oh, and may I dream a little, maybe there could be a nice language reference manual with code examples :)

jeric_synergy
11-30-2011, 06:39 PM
Are there freebie c/c++ compilers? That are worth a damn?

falogfx
12-01-2011, 12:05 AM
Are there freebie c/c++ compilers? That are worth a damn?

For sure, I've installed Microsoft's Visual C++ Express which is free and there are numerous others. I googled this http://www.thefreecountry.com/compilers/cpp.shtml

BigHache
06-03-2012, 01:47 PM
This script keeps saving my bacon, thank you! :thumbsup:

gerry_g
06-05-2012, 01:48 PM
very useful script, but just a note to say that like a lot of scripts run in LW11 any interactivity that was present when used in prior LW versions is now gone, you don't get a prevue anymore

ShadowMystic
06-06-2012, 02:13 AM
Still hoping for an interactive minislider but this may be beyond the skillset of the original script author.

atnreg
06-25-2013, 02:20 AM
very useful script, but just a note to say that like a lot of scripts run in LW11 any interactivity that was present when used in prior LW versions is now gone, you don't get a prevue anymore

Preview works fine in LW 11.5 :)
This is GREAT, *EXACTLY* what I needed!
I am currently working on objects for 3D-printing and this is excellent to adjust 'gap' for parts where some need to move smoothly and some need to snap tight. I know I need 0.4mm gap for moving parts and 0.1mm for tight fit but with normal Stretch it was impossible to know what percentage was needed.

And even better, this tool remembers all the settings!
The only place for improvement is presets but as it's .ls (hooray for that too!) I can do that myself and of course that is more than this tool was meant for.

Excellent work!

Antti

raw-m
06-29-2014, 07:30 AM
Hope you don't mind me bring this back! This is a great script, very handy, thanks again!

Can I ask a feature request: can we have a Copy button as well, with the option of dialling in x amount of times, as well as the option to keep the original geometry? Basically, so it's building an array of geometry all of equal thickness, but without merging points.

falogfx
06-29-2014, 11:16 AM
Hi, it has been a long time since I last visited these forums. Work seems to have taken me somewhat away from 3D.
While the feature request is nice I think it falls somewhat out of the scope of this script, going from pure geometry modification to an object multiplier. Feel free though to use the LScript code to create your own script. If I ever get some spare time I might look into this script again but for now your safest bet is to make it yourself. Happy coding :)

jeric_synergy
06-29-2014, 11:19 AM
falogfx, thanks for the script. :santa: The more I ponder it, the more I'm amazed it didn't exist natively! I mean, "RADIAL MOVE" seems like a very basic concept.

:thumbsup:

Waves of light
06-29-2014, 12:45 PM
Very kind of you.

erikals
06-29-2014, 07:09 PM
Beautiful script, thank you ! http://erikalstad.com/backup/misc.php_files/king.gif