Skip to content

MAXScript

We updated the MaxScript interface in Pencil+ 4, greatly improving its usability compared to Pencil+ 3. Please consult the section [MAXScript Help] in the 3ds Max Help for details about using MAXScript.

Pencil+ 4 Line / Properties - Methods

linesets

Array for getting and setting Line Sets.
This used to be a method in Pencil+ 3, but it has now been changed to a property.

solveDuplicatedMtlsByName (Method)

Performs the same operation as the button [Update Materials]. Replaces materials in Line Sets that are not allocated to an object in the scene with materials that have the same names and exist in the scene.

Return value: Number of materials replaced.
Parameter: None.

removeUnusedMtls (Method)

Removes from the material list materials in Line Sets that are not allocated to an object.

Return value: Number of materials removed.
Parameter: None.

Pencil+ 4 Line set / Properties

objects

Array for getting and setting objects.

mtls

Array for getting and setting materials.

[Access all the Brush Settings in Pencil+ 4 Line Sets]

- brush
- brushOutline
- brushObject
- brushIntersection
- brushSmoothingGroup
- brushMaterialID
- brushNormalAngle
- brushWire
- brushSelectedEdge
- brush_Hidden
- brushOutline_Hidden
- brushObject_Hidden
- brushIntersection_Hidden
- brushSmoothingGroup_Hidden
- brushMaterialID_Hidden
- brushNormalAngle_Hidden
- brushWire_Hidden
- brushSelectedEdge_Hidden

Pencil+ 4 Material / Properties

zones

Array for getting and setting Zones.
This used to be a method in Pencil+ 3, but it has now been changed to a property.

Pencil+ 4 Material / Line Related Function / Properties

maskingOffObjects

Array for getting and setting the objects of [Draw Hidden Lines of Targets as Visible Lines].
This used to be a method in Pencil+ 3, but it has now been changed to a property.

maskingOffMtls

Array for getting and setting the materials of [Draw Hidden Lines of Targets as Visible Lines].
This used to be a method in Pencil+ 3, but it has now been changed to a property.

maskHiddenLinesObjects

Array for getting and setting the objects of [Mask Hidden Lines of Targets].
This used to be a method in Pencil+ 3, but it has now been changed to a property.

maskHiddenLinesMtls

Array for getting and setting the materials of [Mask Hidden Lines of Targets].
This used to be a method in Pencil+ 3, but it has now been changed to a property.

Get/Set Curve Values

The class Pencil_4_Curve_Control_Interface was defined to manipulate curve controls. Properties to retrieve the class above were also added to the following locations.

  • Pencil_4_LineReduction : curveIF
  • Pencil_4_BrushDetail : sizeCurveIF
  • Pencil_4_BrushDetail : alphaCurveIF
  • Pencil_4_Stroke : sizeCurveIF
  • Pencil_4_Stroke : alphaCurveIF

For example, you can use the following script to access curves of a Pencil+ 4 Line that is set first to effects.

ccif1 = (getEffect 1).linesets[1].sizeReduction.curveIF
ccif2 = (getEffect 1).linesets[1].brush.detail.alphaCurveIF

Pencil_4_Curve_Control_Interface / Properties - Methods

curveControl New!

Get/Set the target curve control. The curve control is set beforehand when the instance is acquired from a property such as Pencil_4_LineReduction.curveIF.

controlCurveIndex New!

Get/Set the index of the curve manipulated by this interface class. Initialized to 0.

numPoints New!

Get/Set the number of points on the curve.

pointsX New!

Get/Set the X coordinates of the curve points as a float array.

pointsY New!

Get/Set the Y coordinates of the curve points as a float array.

inTangentsX New!

Get/Set the X coordinates of the in tangents for the curve points as a float array.

inTangentsY New!

Get/Set the Y coordinates of the in tangents for the curve points as a float array.

outTangentsX New!

Get/Set the X coordinates of the out tangents for the curve points as a float array.

outTangentsY New!

Get/Set the Y coordinates of the out tangents for the curve points as a float array.

flags New!

Get/Set the flags of the curve points as an integer array.
Please refer to the 3ds Max SDK documentation for details about the flags.

https://help.autodesk.com/view/3DSMAX/2015/ENU/?guid=__cpp_ref_class_curve_point_html

getValues (Method) New!

Get the curve values.
Return value: Float array containing the curve values for the X coordinates specified as parameter.
Parameter: Float array containing the X coordinates for which we want values.

Sample script changing a curve to a decreasing linear curve.

ccif1.numPoints = 2

ccif1.pointsY = #(1.0, 0.0)

ccif1.flags[1] = ccif1.flags[1] - (bit.and ccif1.flags[1] 3) + 2  -- +1 Bezier / +2 Corner / +3 BezierCorner 

ccif1.flags[2] = ccif1.flags[2] - (bit.and ccif1.flags[2] 3) + 2



-- Clear the tangents

ccif1.inTangentsX= #(0.0, 0.0)

ccif1.inTangentsY= #(0.0, 0.0)

ccif1.outTangentsX= #(0.0, 0.0)

ccif1.outTangentsY= #(0.0, 0.0)



-- Get values

values = ccif1.getValues #(0.0, 0.25, 0.5, 0.75, 1.0)