Spline question

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  11 November 2003
Question Spline question

Hi, first off I'd just like to say thanks for reading this. OK, I've never really used MaxScript before, and what little I've done is only emulating the basic creation of objects that the MaxScript Listener shows.

I'm trying to create a spline line that goes from point A to point B. Pretty simple stuff right? I need the line to be renderable. Pretty much I have a spreadsheet of points in space, and I need lines to connect these points.

Question 1 is how do I input the vertex position data?

line pos:[0,0,0] isSelected:on wirecolor:(color 255 255 255)
That's what the MaxScript Listener shows when I create a new line, no matter what the points are. But I don't see where the 2 vertices get input.

Question 2 is how do I make the line renderable?

MaxScript Listener doesn't show anything when I use the check box for renderable option.

I'm more of a data input type guy myself, and couldn't figure this out if you gave me month on my own.

Max 5.0
  11 November 2003
[color=orange-red]-- first you have to create a shape[/color]
s = splineshape()

[color=orange-red]-- it seems backwards, but next you have to add
-- a spline segment to the shape[/color]
idx = addNewSpline s

[color=orange-red]-- now you can start adding knots to the spline.
-- this code assumes you already have an array
-- of point3 values for your knot positions[/color]
for k in knot_positions do addKnot s idx #smooth #curve k

[color=orange-red]-- now, after updating the shape, you should
-- see your spline in the viewports![/color]
updateShape s

[color=orange-red]-- here's how you set the renderable and thickness properties[/color]
s.baseobject.renderable = true
s.thickness = 0.5

[color=orange-red]-- and you can display the render mesh in the
-- viewports like this[/color]
s.displayrendermesh = true

Got Maxscript?
  11 November 2003
Re: Spline question

Quote: Originally posted by JeBuS27

Question 2 is how do I make the line renderable?

MaxScript Listener doesn't show anything when I use the check box for renderable option.

Max 5.0

Short addition to Roger's excellent answer.

First, you have hit one of the few "special cases" in MAXScript that required additional explanations and large NOTE paragraphs in the Help.

The .renderable property of the splines was implemented after the original MAXScript implementation during Max 1.x times. At that point, every geometry object already had a .renderable property in the Object Properties dialog that controlled the visibility to the renderer.
When the Spline's renderable property was introduced, it was given the same name which led to an internal name conflict. (I assume this could be seen as a bug, but when it was noticed, it was probably too late to change the system without breaking old scripts, so it remained this way up until 6.0)

That's why you cannot just flip the state of the yourSpline.renderable property (which toggles the checkbox in the Object Properties), you MUST use yourSpline.baseObject.renderable which references the base object seen at the bottom of the modifier stack and will toggle the correct checkbox to turn the spline into a renderable mesh...

And a second point - the Question "How do I create a line between two points" was added to the new FAQ section in the MAXScript Online Help for Max 6.0 along with answers to many other typical questions posted to this and other forums. JFYI, should you upgrade to 6.x someday...

  11 November 2003
Hey, thanks for the responses guys. I ended up finding a work-around for my problem while waiting for the first response. And it is working out quite well for me. I just used planes with the angle figured out by using a little trigonometry.
  12 December 2003
Hah! Your "short addition" might be longer than my answer, Bobo

Got Maxscript?
  01 January 2004
Can one assign different thicknessess along the rendermesh?

Sorry for butting in but this is something I have being trying to solve for some time. Beleive me I am king novice here.

Vitruvian man is on a square roll.
  01 January 2004
Unfortunately, you can't do that. To do something like that, you'd have to write a custom extrusion routine that follows the spline, which would be far from trivial for the novice programmer. However, if you've got the fortitude to try it, I'd recommend looking at the extrude along spline code from Meshtools (or was it csPolyTools, my memory fails me!) for some pointers about how to tackle such a thing. Somebody (I think it was Chris Johnson) also wrote some sort of "draw extrusion" script that might prove useful, so long as it's not an encrypted source. These tools should be available at www.scriptspot.com.

If you go for it, best of luck to you

Got Maxscript?
  01 January 2004
Custom extrusion routine??!

Thank you for the pointer.

It looks like too many sleepless nights, but it is good to know the limits.

Although I will checkout the links you offered.

Vitruvian man is on a square roll.
  01 January 2006
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:47 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.