Itoo Software Forum

RailClone => RailClone Pro (*) => Topic started by: ludwig on May 11, 2015, 08:52:18 AM

Title: Expression Editor
Post by: ludwig on May 11, 2015, 08:52:18 AM
Hello,

Is there any Tutorial about the specific functionality of the parameters contained in the Expression Editor. Let me give some examples:

1. How can I control the pitch of a segment? May the pitch be 5 grades at the start and 30    grades in the end
2. How can I control a segment in Z-direction on the spine?
3. Is there a possibility to create a ProCutter detail with RailClone, as you can do with 123D Make to get a file for CNC-application?

Sorry for eventually using the technical terms incorrectly,
even more i would be happy about helpful answers,
thanks.
Title: Re: Expression Editor
Post by: Paul Roberts on May 11, 2015, 12:47:59 PM
Hi,

There isn't currently a tutorial that systematically goes through each of the functions of the expressions editor, but you'll be pleased to know that we have plans to release a guide to expressions in the future. In the meantime it might be helpful to know that expressions use the same class as found elsewhere in max. You can read more about this in Autodesk's documentation here (http://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/3DSMax/files/GUID-B8CBF0C7-B901-4A87-8D20-778BBE12BEA6-htm.html) (with the exception of the predefined variables with variable values, which are not supported)

As well as these we have added the RailClone specific variables you see in the list on the right of the Expression editor. Clicking on each of these should give you a brief description but below is summary.
Inputs
Input1,2,3 etc These refer to any value wired into the Arithmetic nodes inputs. The number relates to the input slot counting from the top down.

Spline Variables
XSplineCoords,YSplineCoords Refers to the position of the current segment over the Spline on the local coordinates measured from the RailClone objects pivot point.  To access the value for a particular axis ,X axis for example, you must append a .x,.y,or .z to the end of the variable, e.g. XSplineCoords.x
XSectionLength, YSectionLength returns the length in scene units of the current section where a section is the path between two Start, End, Corner or Evenly segments.
XSplineLength, YSplineLength returns the length in scene units of the current spline.
XSplinePosition, YSplinePosition returns the position of the current segment on the spline. This is measured not as an absolute measurement in scene units but a decimal value between 0 and 1 that represents the position of the current segment along the spline.
XSectionPosition, YSectionPosition Like above but instead of returning the position along the spline, returns the position along the spline section  where a section is the path between two Start, End, Corner or Evenly segments.
XSplineType returns 0 if the spline is a line and 1 if it is a curve. Useful for conditional statements.
XSplineMatID returns the material ID applied to the current spline section.

X Vertex
XVertexType returns 0 if the current or previous vertex is of the type smooth, 1 if it is a corner, 2 if a Bezier, and 3 if it is a Bezier-Corner. Useful for conditional statements.
XVertexAngle returns the Angle between X Spline segments on the current vertex measured between 0 and PI radians. (0 - 180 degrees when converted)
XVertexWideAngle returns the angle between X Spline segments on current vertex  measured between 0 and 2*PI radians. (0 0 360 degress when converted)

Segments
SegmentXCounter, SegmentYCounter returns the current segment's index along the path. Note that there are two separate counters: one for default segments, and another for Start/End/Corner/Evenly combined.

By combining these built in variables with Max's expression functions we can create some interesting mathematical relationships within RailClone. For example, in your first question you would like to control the rotation based on the segments position along the path. If we look at the list above we can see that the XSplinePosition variable should help us here. Here's how:


The same sort of thing can be done for the Z Direction by exporting Z Fixed Translation from the Transform node. Take a look at the attached style which uses a sine wave to create an undulating pattern.

Quote
Is there a possibility to create a ProCutter detail with RailClone, as you can do with 123D Make to get a file for CNC-application?

RailClone isn't really designed for this purpose so there's not an easy way to produce the splines required for laser cutting or CNC fabrication. Having said that, RailClone outputs an editable poly so you should be able to use one of the many scripts available for this purpose. I've tested this one  (http://www.scriptspot.com/3ds-max/scripts/sectioning)and it works fine but there may be others.

However, I suspect that you'll need a watertight mesh if you intend to fabricate from 3d models, so in RailClone you'll probably want to take a few precautions to ensure that vertices are welded correctly. To do this:


I hope that helps, I've attached the examples discussed above for you take a look at. Please let me know if you have further questions.

Many thanks,

Paul
Title: Re: Expression Editor
Post by: ludwig on May 19, 2015, 09:36:20 PM
Many cordial thanks for the very helpful and fast answer. I am very happy about the comprehensive and detailed help