mcjBuilderA


 






When i built the mcjCastle prop i needed handrails for the stairs, and i wanted to be able to quickly re-build them.

So i wrote a script, then i improved it to build the castle wall's baseboards and crowns.

Basically, this script creates extruded moldings in wavefront ( obj ) format.

 



 September 16th 2017 6:47am the "material" command now works correctly with the loaded/dropped .obj
 September 16th 2017 6:23am Beta 9.0 Added operations loadObj dropObj and nomatObj
 June 1 2014 6:00 pm  Beta 8.1 fixes issues with endCaps ( related tp the use of the profile-preview curves )
 May 31 2014 3:24 am  Beta 8 - DS 4.6 compatibility - extended daz-script access to the scene
 May 25 2014 11:59 pm  Beta 7 - multi-mesh closed-paths fixed, PathCaps
 May 24 2014 1:30 pm  Beta 6.98 Var, Set,Trans, 
 May 12 2014 12:02 am  Beta 6 release - many improvements and safety checks
 April 29, 2014 9:30 am  Beta 5 release - fixed issue with extrusion path scripts loaded / Imported in .obj format 
 Apr 28. 2014, 12h45 pm  Beta 4 release a bug limited to scripts using the "closePath" command was fixed,
The collection of txt-format path files now contains the "square" script which is the default
path-script mcjBuilderA looks for upon the first launch
 Apr 27. 2014,   Beta 3 release "define" supports more than 1 parameter, slope now applies during "move/Move Z" 
 Apr 26. 2014  Beta 2 release
 Apr 8, 2014, 10:23 PM   Beta 1 Release - with missing profile curves
 Apr 8, 2014, 10:36 PM  Beta 1 Release includes paths and profile folders
   
   
 
 .   



Installation


The zip package is found at the bottom of this page

unzip it in a daz content folder, typically 


C:\Program Files\DAZ\Studio\content\ 

or


C:\Users\YOURUSERNAME\Documents\DAZ 3D\Studio\My Library


once installed, it will appear in your content library, under 


studio\Scripts\mcasual


or


My Library\Scripts\mcasual



The script is accompanied by a series of folders that contain molding profiles and some extrusion paths.


Since you may eventually add your own profiles and paths, it's better to install the script in 


C:\Users\YOURUSERNAME\Documents\DAZ 3D\Studio\My Library


because you have full read/write access to the files contained in that folder




Use



Here is the default state of the script 

You can always return to this state by clicking on the "Defaults" button



in the upper--left corner you see the extrusion path definition text, which we will call the extrusion path script

since the "View extrusion profile" option is selected, in the "blackboard" area you see the extrusion profile

if we click on "View extrusion path" now we see .... the extrusion path.



"hardturn 90" means , make a 90 degrees corner

 "move 16" means  : "advance 16 steps"

by editing the extrusion path script you could create different rectangular and square frames

lets build it !

click on the "Build" button

specify the location and name of the mesh file that will be created : example : basicMesh.obj

a few seconds later the object exists on your disk!

click on the "Load Obj" button

this will load the recently created object in the scene



The dimensions of the frame depend on the number of steps made by each "move" command ( ex: "Move 16"  )

The length of each step is given by the "Tread" setting which can be found in mcjBuilder A's "Settings for the extrusion path" panel

The term "Tread" comes from the stairs building terminology.

The default value is 1 inch

You'll note at the top of the path script that we changed "Tread" to "2" by issuing a "Tread 2" command

The size of the extrusion profile ( the diameter of the tube ) can be found in  "Settings for molding profile"  panel

The default values were 1 x 1 inch





Other molding profiles - the profiles library


page

More than 84 molding profiles come bundled with this script

the profiles ( library ) folder is in the same folder where the script was installed

( in my case C:\Program Files (x86)\DAZ\Studio\content\Scripts\mcasual\mcjBuilder\profiles\obj )

using the drop-down list shown below you can select other profiles


using the "Profiles library ..." button you can specify the location of the library folder

If you intend to create your own profile curves:

The profile curves are contained in (.obj) files ( also called wavefront files )

the profile mesh must be one continuous polygon

this polygon must preferably be oriented on the XY plane

our default round profile shape for instance is a 32-sided polygon

the dimensions of the polygon do not matter, they get normalized by the script






Maintaining the profile proportions

Each time you select a new profile curve, 

mcjBuilderA suggests a height 

which will give the extrusion profile the same width-height ratio 

as the original molding profile.






Other profile curve options


for profile curves like the U shaped curve shown below, you can de-select the "Close Profile" check-box

and the script will leave the extrusion curve open





The MirrorX and MirrorY options let you reorient the profile curve

the red cross in the preview screen indicates the [0,0,0] coordinate, it's also the attach point for the extrusion path






The path script editor buttons


Load - Lets you load a path curve from a .txt or .obj file - if the file is an obj file, it will be converted to text format

Save As... - Save the extrusion path script ( a text file ) at the specified location.

Save  - Save the extrusion path script ( a text file ). overwriting the last one saved!

Clear - Clears the editor

Paste - The complete set of path and profile settings will be pasted at the bottom of the extrusion path script 

     
  Profile FrLegacy2

MoldSize 1 0.42

profileUnits in

profilemirrorx off

profilemirrory off

closeprofile on

PathUnits in

Tread 1

Slope 0

Radius 1

ClosePath on

WeldUVs off

StepAngle 11.25

InvertNormals off

InvertUVu off

RotateUVs off

 
     


The Extrusion path settings


Tread - the global scale of the extrusion path, Example: if Tread is 10 inches , and the path script contains
 the command "Move 6" then the extrusion will advance by 60 inches. The path script may contain commands 
that override this value.

Step Angle - when the extrusion path includes a "turn" command, this angle serves to control the smoothness 
of the curve. For example, a 90° turn , with a Step Angle of 10 would give us a 9-steps arc. The path script 
may contain commands that override this value.

Slope - with a default value of 0, the extrusion remains at floor level, setting Slope to a value of 1 means 
the extrusion will ramp up at a rate of 1 " per 1" of extrusion. The path script may contain commands that 
override this value.




Radius  if the path script contains "turn" commands, then Radius is the default radius for those arcs of circle

the path script may contain "radius" commands that override this default value





Close Path - if this option is enabled, the script will add an extrusion segment going from the last point of the path to the first point.

note : if you create a straight molding segment and this option is on ... nothing good will come out of it !




WeldUVs - The UVs, also called texture coordinates tell the rendering program ( Daz Studio ) how to layout the image 

applied to the 3d model surfaces. When the WeldUVs option is Off, the script is allowed to cut the UV map in sections 

and achieves non-distorted texturing, notably for rectangular frames.  When the WeldUVs option is ON, the UV 

coordinates for subsequent segments of the extruded tube are merged / averaged / welded together this introduces 

texture-image distortions , but is often not very noticeable, and for this price we get continuous surface textures.





Invert Normals:If you render an extruded object using Daz Studio's software renderer and you use the cartoony 

shader or certain advanced shaders, the result may come out black! This is because this specific surface is seen 

by Daz Studio as being inside-out. The extrusion profile and extrusion path you chose determined this. By turning 

on the "invert normals" option, mcjBuilder will flip them outside-in.

technically speaking: 

    facet is created by stringing vertices 
    if the vertices are given in the counter-clockwise order, 
    the surface normal is deemed to point toward the observer
    and Daz Studio considers this side of the facet as being outside the object
    if the vertices are given in the clockwise order
    the surface normal is deemed to point away from the observer
    and daz studio considers the observer side of the facet as being inside the object 
    ... so it comes out black when using certain shaders 
    or inside out in the case of Poser





Invert Texture X: depending on the chosen extrusion profile and path, the texture image may come out mirrored, 

This option will fix this by inverting the U's of the UV map




The Export as obj Polygon button - will export the current extrusion path as one polygon - 

This polygon could then be used as the canvas if your path is a framed painting.

If the path has 32 segments, this polygon will have 32 sides ! If your path contains cavities ( non-convex),

then the polygon produced will not be usable as a cap/lid

Note that the paths exported using this method can be used as profile curves,  

if you place them in your scripts/mcasual/mcjBuilder/profiles/obj folder !!

which is exactly what happened in the image below



The "Update Preview" button : when you click this button, mcjBuilder re-evaluates the content of the path script ( text ) panel 

and re-generates the graphical display




Composing your own Path Scripts


As you could see above, the extrusion path scripts are in fact text files.

They are series of commands and parameters 

When there's a parameter it must be separated from the command using a Tab

read further down this page for the much expanded sets of commands 

 Command  Alternate  Parameters  Description  Example
 Move  MoveZ  steps Moves the extrusion nozzle without creating a ring of vertices. 
The parameter is the number of steps to make. 
The current angle of the nozzle determines the direction of the movement. 
The value of "Tread" is the length of the step. 
So the command "Move [tab] 6" with a Tread of 10 inches gives you a  60 inches movement.
Tread    12
PathUnits    inches
Ring
Move
    5
Ring
 Ring     Creates a ring of vertices at the current location of the nozzle Ring
Move    1
Ring
 Turn  TurnY  angle Creates an arc of a circle. The angle is in degrees often 90. The current value of "AngleStep" determines
the smoothness of the arc. For example, if "Angle Step" is 10 and the Turn angle is 90, the arc of a circle
will divided in 9 segments. The current value of "Radius" is the radius of this arc.
StepAngle    11.25
Radius    1
Turn    90 
 Slope    rate Sets the rate at which the nozzle climbs as it moves forth or "turns". With a default value of 0, the
extrusion remains at floor level, a value of 1 means the extrusion will ramp up at a rate
of 1 inch per 1 inch of extrusion.
slope    1
Ring
Move    1
Ring
 Hardturn    angle This command is specifically for the creation of frame corners. The angle is in degrees usually 90. 
mcjBuilder turns the extrusion nozzle by half that angle, then it creates a ring of vertices, 
then if turns the extrusion nozzle by the full angle. mcjBuilder Scales up the width of the
extrusion profile by just the right amount to keep the width of the extrusion constant.

Hardturn 90

Move 2

Hardturn 90

Move 2

Hardturn 90

 MoveTo    x y z  moves the extrusion nozzle to this x,y,z position without creating a ring of vertices

MoveTo    0    1    0

Ring
MoveTo    0    1    5
Ring

 Radius    radius  changes the radius of upcoming "turns"   
 WeldUVs    on/off  Sets if welded UVs will be used during .obj export. For right-angled frames, WeldUVs is usually set Off. For curvy moldings WeldUVs is usually set On.The example shown here creates a 2 'x 2' frame; Tread 12
PathUnits    inches
WeldUVs Off
Hardturn 90
Move 2
Hardturn 90
Move 2
Hardturn 90
Move 2
Hardturn 90
Move 2
Hardturn 90





The Update Obj button

This button is slightly dangerous but also a great time saver

it's like using the Build button, except you don't get 

to specify which .obj file will be written to.

Instead, it over-writes the previously built .obj file

then it deletes all objects in the scene which match this name.

Then it loads the newly created obj file in the scene

if you want to protect objects in your scene, change 

their name ( label ) in Daz Studio's scene tab

the idea is: 

you write your build script

build it

load it

you see mistakes

tweak your script

click the update button

you see mistakes

tweak your script

click the update button

.....


The Export As Obj Triangles button ( New in Beta 3 )

In version 1 we had the "Export as obj" button which exports the extrusion path as one big polygon.
This polygon could be used as a Profile/Mold curve or it could be used as a cap/canvas/lid

this button was renamed "Export as Obj  Polygon".

Daz Studio does not handle polygons like this very well, it prefers triangles and 4-sided facets

The "Export as Obj Triangles" button creates the same shape from the extrusion path  but chops it into triangles

that share a central point
\





The Export As Obj Tesselated button ( New in Beta 6 )

In many circumstances the The "Export as Obj Triangles" button produces acceptable path-cap meshes

but if the path contains many concavities the result may be unusable. The "Export As Obj Tesselated" button

will chop the cap into triangles but it will use the "ear clipping" method instead of the common-central-vertex method.


========================================================================================================================
========================================================================================================================
========================================================================================================================
All the commands !
========================================================================================================================
========================================================================================================================
========================================================================================================================


Repeat  / RepeatEnd


 Command  Alternate  Parameters  Description
 Repeat    n Begins delimiting a block of commands which will be repeated n times
 RepeatEnd     Ends the delimitation of a block of commands

The following will execute the "turn 120" and the "turn -120" commands 5 times

Note that ( for now ) you cant have a repeat block within a repeat block

Example: The Repeat Command

     
 
radius .2

repeat 5
turn 120
turn -120
repeatEnd

 
     




Define / DefineEnd 


 Command  Alternate  Parameters  Description
 Define    name param1 param3 ..... Begins delimiting a block of commands which will become a command named "name"
Optionally, the name can be followed by a list of parameter names. When you invoke this newly defined command, the parameter values can then be used throughout the block of commands by using the corresponding parameter names. 
 DefineEnd
    Ends the delimitation of a block of commands

note that you cant start a define within a define

in the example below, the name "wiggles" is given to a block of 4 commands

later on this block of commands is executed simply by typing "wiggles"

Example: The Define Command Without Parameters

     
 

radius .2


define wiggles

repeat 5

turn 120

turn -120

repeatEnd

defineEnd


wiggles

turn 120

wiggles

turn 120

wiggles

turn 120


 
     


optionally, you can add a list of parameters along with your definition

in the example below, we  are defining a block of commands named "wiggles"

this custom command will be accompanied by 3 parameters named "n, "a"  and "b"

note how, within the block of commands, the parameters "n", "a" and "b" are used 

to modulate how many "turns" will be performed and the angle of those "turns"

later when we execute the "wiggles" command we must not forget to supply exactly 3 parameters

Example: The Define Command with Parameters

     
  radius .2
define wiggles n a b
repeat n
turn a
turn b
repeatEnd
defineEnd

wiggles 3 90 -90
turn 180
wiggles 3 90 -90
turn 180
 
   
 




Break


 Command  Alternate  Parameters  Description
 Break    
This command lets you create more than one mesh with a single script. Each time you insert a "break" command the commands that follow are taken as being a new separate object


Example, this will create 4 tubes  with a gap between them


     
 

repeat 4

Ring

Move 1

Ring

rotate 90

Move .1

break

repeatEnd


 
   
break
 




ClosePath - Warning : for the current versions this doesn't seem to work well for multiple short objects ... it may even crash Daz Studio, its that bad



 Command  Alternate  Parameters  Description
 ClosePath    On/Off, Yes/No, True/False
For each object, specifies if a closing segment must be added to the extruded object, The initial value of ClosePath can also be set in mcjBuilderA's "Path Settings" panel

Example: ClosePath Off

     
  stepAngle    10
ClosePath    off
Turn    300


 
   
 


Example: ClosePath On

     
 


stepAngle 10
ClosePath on
hardTurn 90
Move 1
Turn 180
Move 1
hardTurn 90
Ring


 
   
 



WeldUVs


 Command  Alternate  Parameters  Description
 WeldUVs    On/Off, Yes/No, True/False
For each object , specifies if neighboring texture coordinates must be fused
this insures the continuity pf the texture but introduces stretching
The initial value of WeldUVs can also be set in mcjBuilderA's "Path Settings" panel


Example : WeldUVs on

     
 

radius .33

stepAngle 45

WeldUVs on

Turn 360


 
   
 


Example : WeldUVs off

     
 

radius .33

stepAngle 45

WeldUVs off

Turn 360


 
   
 



ProfileMirrorX 


 Command  Alternate  Parameters  Description
 ProfileMirrorX     On/Off, Yes/No, True/False
For each object , specifies if the profile curve must be mirrored horizontally
The initial value of profileMirrorX  can also be set in mcjBuilderA's "Profile Settings" panel.

Example: ProfileMirrorX    On

     
 

radius .33

ProfileMirrorX on

Repeat 4

Turn 90

Move .2

Ring


 
   
 


Example: ProfileMirrorX    Off

     
 

radius .33

ProfileMirrorX off

Repeat 4

Turn 90

Move .2

Ring


 
   
 


ProfileMirrorY


 Command  Alternate  Parameters  Description
 ProfileMirrorY     On/Off, Yes/No, True/False
For each object , specifies if the profile curve must be mirrored vertically
The initial value of profileMirrorY  can also be set in mcjBuilderA's "Profile Settings" panel.

Example: ProfileMirrorY    On

     
 

profileMirrorY on

radius .2

turnX -360


 
   
 


Example: ProfileMirrorY    Off

     
 

profileMirrorY off

radius .35

turnX -360


 
   
 




ProfileUnits 


 Command  Alternate  Parameters  Description
 ProfileUnits    cm, centimeter, centimeters, centimetre, centimetres in, inch, inches, po, pouce, pouces ft, feet, foot, pi, pied, pieds m, meter, meters, metre, metres For each object, the units for profile dimensions.
The initial value of ProfileUnits can also be set in mcjBuilderA's "Profile Settings" panel 



MoldWidth/ProfileWidth MoldHeight /ProfileHeight   and MoldSize/ProfileSize 


 Command  Alternate  Parameters  Description
 MoldWidth   ProfileWidth  width For each object, the profile width. The initial value of MoldWidth can also
be set in mcjBuilderA's "Profile Settings" panel.
 MoldHeight   ProfileHeight   height For each object, the profile height. The initial value of MoldHeight can also
 be set in mcjBuilderA's "Profile Settings" panel.
 MoldSize   ProfileSize   width height  For each object, the profile dimensions.The initial value of MoldWidth and
MoldHeight can also be set in mcjBuilderA's "Profile Settings" panel.

Example using MoldWidth, MoldHeight and MoldSize to create many mold shapes from the same profile

     
 

MoldSize 1 1

Ring

Move 1

Ring

break

Move -1

MoveX .5

MoldWidth 2

Ring

Move 1

Ring

break

Move -1

MoveX .5

MoldHeight 4

Ring

Move 1

Ring

break


 
   
 




Profile


 Command  Alternate  Parameters  Description
 Profile    name
For each object created by your script, the profile/mold curve to use. 
The initial value of Profile can also be set in mcjBuilderA's ""Settings For Molding Profile"" panel using a drop-down list labeled "Profile".
The name must be exactly the same as one of the curve names in the "profile" drop-down list
The "Paste in script" button of the "Settings For Molding Profile" panel 
will copy and paste the currently selected profile curve name at the bottom 
of the Extrusion Path Script


Example: Using the Profile and Break commands to create 2 tubes with differing profiles 

one that uses the "georgian" profile the other uses the "square" profile 

Also note how i used the setScaleX and Move commands to create end caps

     
 
define
rail
SetscaleX 0
Ring
SetscaleX 1
Ring
Move .11
Ring
Move 1
Ring
break
defineEnd

profile georgian
rail
MoveTo .5 0 0
profile contemporary
rail

 
   
 



Material


 Command  Alternate  Parameters  Description
 Material   name For each object created by your script, this will create a "usemtl" statement in the obj file.
If this mesh has "endcaps" the material name for the caps will be derived from this.
To play it safe, name should only contain letters and numbers, no spaces, no underscores, no dashes.

Example : the material command

     
 
define rail

SetscaleX 0
Ring
SetscaleX 1
Ring
Move .11
Ring
Move 1
Ring
break
defineEnd

profile georgian
Material matGeorgi
rail

MoveTo .5 0 0

profile contemporary
material matContem
rail
 
   
 
   
 


Group


 Command  Alternate  Parameters  Description
 Group   name For each object created by your script, this will create a "g" statement in the obj file.
3d modeler software will use this as the object/mesh name
Daz Studio wont use this information unless you're creating a figure
To play it safe, name should only contain letters and numbers, no spaces, no underscores, no dashes.

Example : the Group command


     
 
define rail

SetscaleX 0

Ring

SetscaleX 1

Ring

Move .11

Ring

Move 1

Ring

break

defineEnd


profile georgian

Group railA

Material matGeorgi

rail


MoveTo .5 0 0


profile contemporary

Group RailB

material matContem

rail


 
     
     


Slope


 Command  Alternate  Parameters  Description
 Slope   rate Sets how much the extrusion path climbs or side-steps for each movement forth.
The initial value for this parameter is set in the "Path settings" section.
A value of 0 disables the slope effect.
When performing a turn/turnY command, the slope-induced movement is Up/Down.
When performing a turnUp/turnX command, the slope-induced movement is sideways.
When performing a twist / turnZ command, the slope-induced movement is back/forth
When performing a Move/MoveZ command, the slope-induced movement is Up/down
Those movements are relative to the current orientation of the nozzle.

Example :Using the Slope and turn commands to create an upstanding coil

     
 


MoveTo -3.183 0 5

radius 3.183

slope 0.25

TurnY 720


 
   
 

the profile size was 10x10 cm
Tread was 10cm
The radius was 3.183 * 10 cm = 31.83cm 
the circumference for 1 turn was 2 * pi * r = 200 cm
for 2 turns ( 720 degrees ) we moved forth by 400 cm
with a slope of 0.25, we moved 100 cm up along the Y Axis

=================================================================

Example: Using the  turnUp and Slopw commands, to create a sideway coil

     
 

radius 3.183

slope -0.25

TurnX -720

break

 
   
 

Understanding Slope

the profile size was 10x10 cm
Tread was 10cm
The radius was 3.183 * 10 cm = 31.83cm 
the circumference for 1 turn was 2 * pi * r = 200 cm
for -2 turns ( -720 degrees ) we moved forth by -400 cm
with a slope of -0.25, we moved 100cm along the X Axis

=================================================================

Example: Using the Slope and Twist command to create a screw

     
  radius 3.182

slope .25

twist 720

 
   
 

the profile size was 10x10 cm
Tread was 10 cm
The radius was 3.183 * 10 cm = 31.83cm 
the circumference for 1 turn was 2 * pi * r = 200 cm
for 2 turns ( 720 degrees ) we get  400 cm
with a slope of 0.25, we moved 100 cm along the Z Axis

note that mcjBuilderA Beta 3 ties the movement forth to the radius and the number of twists
this was not mathematically required but it has the advantage that the 3 "turn" types 
are behaving in similar fashion

=================================================================

Example: Using the Slope and Move command to create a ramp

     
 
slope 1

Ring
Move 10
Ring

 
   
 

the profile size was 10x10 cm
Tread was 10cm
"Move 10" means a movement forth by 10 x 10cm = 100cm
since "slope" is 1, the rail moves up by 100cm for a movement forth of 100cm



Tread


 Command  Alternate  Parameters  Description
 Tread   length
For each mesh, changes the extrusion path scale
The initial value for this parameter is set in the "Path settings" section 

Example : Tread - note how i use setScale to "tie" the tube end like a sausage

     
 
MoveTo 0 1 1

repeat 4

Tread .1

slope 1

Move 2

slope 0

Tread 10

SetScaleY 0.01

SetScaleX 0.01

Ring

SetScaleY 0.5

SetScaleX 0.93

Ring

SetScaleY .95

SetScaleX .99

Ring

SetScaleX 1

SetScaleY 1

Move .1

Ring

Move 3

Ring

break

repeatEnd

 
   
stairSteps
 



StepAngle


 Command  Alternate  Parameters  Description
 StepAngle  AngleStep angle
Changes the step angle for the Turn commands.
The initial value for this parameter is set in the "Path settings" section .

Example : StepAngle

     
 
radius 10

stepAngle 45

turn 90

stepAngle 30

turn 90

stepAngle 22.5

turn 90

stepAngle 11.25

turn 90

 
   
 



Radius


 Command  Alternate  Parameters  Description
 Radius   radius
Sets the radius for the Turn commands to radius
The initial value for this parameter is set in the "Path settings" section.
The effective radius depends on the current Tread and PathUnits

Example :the  Radius command

     
 
stepAngle 15

radius 10

turn 180

radius 20

turn 180

radius 30

turn 180

radius 50

turn 180

radius 80

turn 180


 
   
 




RotateX, RotateZ and Rotate / RotateY 


 Command  Alternate  Parameters  Description
 Rotate  RotateZ angle Changes the orientation of the nozzle by angle degrees around the Y axis 
T
his by itself does not create geometry ( a ring ). That's basically a car steering wheel.
 RotateX       angle Changes the orientation of the nozzle by angle degrees around the X axis  
This by itself does not create geometry ( a ring ). This is like an airplane's "Pitch" control
 RotateZ   angle  Changes the orientation of the nozzle by angle degrees around the Z axis  
This by itself does not create geometry ( a ring ). This is like an airplane's "Roll" control

Example: Using the Rotate command to create a curved tube ( the hard way )

     
 

Ring

repeat 8

rotate 22.5

Move 31.8

rotate 22.5

Ring

repeatEnd

...

 
   
 




SetRotX, SetRotY, SetRotZ and SetRot


 Command  Alternate  Parameters  Description
 SetRotX       angle Directly sets the XRotate control of the nozzle. angle is in degrees
T
his by itself does not create geometry ( a ring ). That's basically a car steering wheel.
 SetRotY      angle Directly sets the YRotate control of the nozzle. angle is in degrees 
This by itself does not create geometry ( a ring ). This is like an airplane's "Pitch" control
 SetRotZ       angle Directly sets the ZRotate control of the nozzle. angle is in degrees 
This by itself does not create geometry ( a ring ). This is like an airplane's "Roll" control
 SetRot    x y z  Directly sets the X, Y and Z Rotate controls of the nozzle. x, y and z are in degrees 
This by itself does not create geometry ( a ring ).

example, creating a curved tube (the hard way )

     
 


setRot 0 0 0

setRotY 0

Ring

setRotY 22.5

Move 10

setRotY 45

Ring

setRotY 67.5

Move 10

setRotY 90

Ring

setRotY 112.5

Move 10

setRotY 135

Ring

setRotY 157.5

Move 10

setRotY 180

Ring

...
 
   
 




Taper, TaperX, TaperY and TaperZ


 Command  Alternate  Parameters  Description
TaperX       rate Sets the rate at which the width ( XScale ) of the nozzle gradually changes.
The tapering is proportional to the 
length of the arcs generated by the Turn
command and the length of the tube generated by the "Move" command.
 TaperY      rate Sets the rate at which the height ( YScale ) of the nozzle gradually changes.
The tapering is proportional to the 
length of the arcs generated by the Turn
command and the length of the tube generated by the "Move" command.
 TaperZ       rate Sets the rate at which the depth ( ZScale ) of the nozzle gradually changes. 
The tapering is proportional to the 
length of the arcs generated by the Turn 
command and the length of the tube generated by the "Move" command.
note that for now mcjBuilder only uzes zero-depth nozzles so yjis has no effect.
 SetRot    rate Sets the rate at which the dimensions( XScale/YScale and ZScale ) of the
nozzle gradually changes. The tapering is proportional to the 
length of the
arcs generated by the 
Turn command and the length of the tube generated
by the "Move" command.

example, The Taper command

note how i end with a taperX 0 and taperY 0, to halt the tapering

     
 

moldSize 20 20

ring

repeat 6

TaperX .7

TaperY .7

Move 1

ring

TaperX -.7

TaperY -.7

Move 1

ring

repeatEnd

taperX 0

taperY 0

Move 20

Ring


 
   
 


TaperR


 Command  Alternate  Parameters  Description
 TaperR       rate Sets the rate at which the radius of the "Turns" gradually changes. 
The tapering is proportional to the 
length of the arcs generated by the Turn 
command and the length of the tube generated by the "Move" command.

TaperR means "taper radius"

After using this command you may want to issue a  taperR 0 command followed by a "radius": command  

to put the radius in a known and stable state.

Example : using the TaperR command to create spirals and coil

     
 
moldSize 22 22

ring

TaperX -.05

TaperY -.05

Move 5

ring

TaperX -.03

TaperY -.03

TaperR -.23

radius 5

turn 720


 
   
 



SetScaleX, SetScaleY, SetScaleZ and SetScale 


 Command  Alternate  Parameters  Description
 SetScaleX   factor Sets the nozzle width scale ( x ) at value, without creating a tube ( a ring ).
A Scale of 1 means no scaling.
 SetScaleY   factor Sets the nozzle height scale ( y ) at value, without creating a tube ( a ring ).
A Scale of 1 means no scaling.
 SetScaleZ   factor Sets the nozzle depth scale ( z ) at value, without creating a tube ( a ring ).
A Scale of 1 means no scaling.
note that for now mcjBuilder only uses zero-depth nozzles so this has no effect.
 SetScale   factor Sets all three nozzle scaling factors at factor.  A Scale of 1 means no scaling.


Example: Using the SetScale Command to create a cornet

     
 


MoveTo 0 10 0

setScaleX 5

setScaleY 5

Ring

Move 2

setScaleX 3

setScaleY 3

Ring

Move 2

setScaleX 2

setScaleY 2

Ring

Move 2

SetscaleX 1

SetscaleY 1

Ring

Move 2

Ring


 
   
 



Ring


 Command  Alternate  Parameters  Description
 Ring  
Creates a ring of vertices at the current location of the nozzle.
In conjunction with the "Move" commands, this lets you create straight tube sections

Example: Using the Ring command

     
 


MoveTo 0 10 0

setScaleX 4

setScaleY 4

Ring

Move 1

Ring

setScaleX 3

setScaleY 3

Ring

Move -1

Ring

setScaleX 4

setScaleY 4

Ring


 
   
 



HardTurn


 Command  Alternate  Parameters  Description
 HardTurn    angle This command is specifically for the creation of frame corners. 
The angle is in degrees usually 90. 
Turns the extrusion nozzle by half that angle, 
Then creates a ring of vertices, 
Then turns the extrusion nozzle by the full angle. 
The width of the ring of vertices is scaled just the right amount ( usually 1.4 )
to keep the width of the extrusion  constant.

Example: using the HardTurn Command to create a frame

     
 


MoveX -8

MoveZ 4.5

HardTurn 90

Move 16

HardTurn 90

Move 9

HardTurn 90

Move 16

HardTurn 90

Move 9

Hardturn 90


 
   
 




TurnUp/TurnX, Turn/TurnY and Twist/TurnZ


 Command  Alternate  Parameters  Description
 TurnUp  TurnX  angle Relative to the current orientation of the nozzle,
Creates an up-down turning curved tube. The angle is in degrees often 90.
The current value of "StepAngle" determines the smoothness of the arc.
For ex.: if "StepAngle" is 10 and the Turn angle is 90,then the arc will
be divided into 9 segments. The radius or curvature can be adjusted
by issuing a Radius command
 Turn  TurnY  angle Relative to the current orientation of the nozzle, 
Creates a right-left turning curved tube. The angle is in degrees often 90. 
The current value of "StepAngle" determines the smoothness of the arc. 
For ex.: if "StepAngle" is 10 and the Turn angle is 90,then the arc will 
be divided into 9 segments. The radius or curvature can be adjusted 
by issuing a Radius command
 Twist  TurnZ  angle Relative to the current orientation of the nozzle, 
twists the extrusion around the Z axis ( the current direction the nozzle is facing )
You will need to accompany this with a Slope command in order to obtain
a lube with a non-zero length.

Example: using the Twist, Turn and TurnUp commands

     
 

slope .01

turnZ 720

radius 1

turn -180

break


Move 1

turnX 90

break


 
   
 



MoveX , MoveY and Move /  MoveZ


 Command  Alternate  Parameters  Description
 MoveX    n Relative to the current orientation of the nozzle, 
Move the extrusion nozzle sideways by steps
This does not create a tube section it just moves the nozzle
The actual distance traveled depends on the Tread setting
 MoveY    n Relative to the current orientation of the nozzle, 
Move the extrusion up/down by n steps
This does not create a tube section it just moves the nozzle
The actual distance traveled depends on the Tread setting
 Move  MoveZ  n Relative to the current orientation of the nozzle, 
Advance the extrusion nozzle n steps
This does not create a tube section it just moves the nozzle
The actual distance traveled depends on the Tread setting

Example: using the Move Commands

     
 


slope .4

repeat 3

Turn 180

taperR -0.25

move 1

taperR 0

Turn 90

repeatEnd


 
   using version Beta 2
 


   using version Beta 3

 





Moveto / SetPos / Pos, SetPosX / SetX / PosX, SetPosY / SetY / PosY and SetPosZ / SetZ / PosZ 


 Command  Alternate  Parameters  Description
 SetPos  MoveTo
 Pos
 x y z  directly set the values of the nozzle's X, Y and Z translation controls
 this does not create a tube section it just moves the nozzle
 SetPosX  SetX
 PosX
 x  directly set the values of the nozzle's X translation control
 this does not create a tube section it just moves the nozzle
 SetPosY  SetY
 PosY
 y  directly set the values of the nozzle's Y translation control
 this does not create a tube section it just moves the nozzle
 SetPosZ  SetZ
 PosZ
 z  directly set the values of the nozzle's Z translation control
 this does not create a tube section it just moves the nozzle

note for advanced users - since we are "playing" with the Local Transforms of the nozzle node, 

one could parent this node to another animated node and obtain complex shapes

for instance a coiled guitar cord

Example:The SetPos Commands

     
 
setPos    0    0    0
rotateX    -90
Ring
Move    1
Ring
rotateX    45
Move    1
Ring
rotateX    45
Move    1
Ring

 
   
 





EndCap


 Command  Alternate  Parameters  Description
 EndCap     creates a non-welded cap at the current location of the nozzle
each  cap has its own material,
the material name is based on the current object/mesh material

The caps are tesselated using the "ear clipping" method.

Tesselation is derived from c# code written by Bill Overman http://www.codeplex.com/PolygonTriangulation


Example:The EndCap Command

     
 

Profile gear6

Ring

endCap

Turn 90

endCap


 
   
 





Maths and stuff sin, cos, tan, + - * / and a few variables - New in Beta 6


Starting with beta 6, the parameters you supply can be given as formulas instead of simple constants

all the Daz Scripting functions are available

so you can write Move 10*Math.random()

the only restriction is that your formulas must not contain blank spaces

to reduce typing overhead, the following math functions were pre-defined, so you don't need to type the Math. prefix

sin(), cos(), tan(), abs(), log(), pow(), random(), sqrt()

so you can write Move 10*random()

sin, cos, tan take angles expressed in radians

use a formula as follows to convert angles from degrees to radians

example for 30 degrees

Move 10*sin(30*pi/180)

Example:Maths

     
 

define wholelottamovin a b

Ring

Move 60/4

Ring

move a*10

Ring

move 10*b*sin(a*10*pi/180)

Ring

defineEnd

MoldSize 4 4

Tread .25

wholelottamovin 3 5

 
   
 




As the script reads your extrusion-path-script and builds your object, it maintains a set of variables, for example, if you use the repeat command
it keeps track of the number of repeats performed in the form of a variable named "count".

In this section you will find the list of sucj variables


fr


The extrusion process involves the creation and animation of a null node named "extruder"

Each time a ring is added to your extruded mesh, a keyframe is added to the "extruder" animation

mcjBuilder gives you access to the current animation frame number under the name "fr"

so if you do


     
  ring
Move    1
ring
Move    1
ring
Move    1
 
     

at this point of the path the animation is at frame 3, so fr = 3

we can now put that nifty fr variable to use 

and obtain consecutive ring scaled by a factor of, 0, 1, 4, 9, 16

     
  MoldSize 1 1
Tread 3
SetScale fr*fr
ring
Move    1
SetScale fr*fr
ring
Move    1
SetScale fr*fr
ring
Move    1
SetScale fr*fr
ring
 
   
 




count 


When you use the Repeat command, mcjBuilder also lets you see the value of the 

counter it uses to perform the repeats you commanded.

This variable is named count ( you can also use the old name grcpt )

For the first pass, count = 0

we can now put that nifty count variable to use 

lets make a picket fence

     
 

define picket z

SetRotX -90

SetY 0

SetZ z/3

Ring

Move 3

Ring

Move .25

SetScaleY .001

Ring

break

SetScaleY 1

defineEnd


profile square

Tread 12

MoldSize .75 3


repeat 10

picket count

repeatEnd


 
   
 

note after building a picket, which ended with a SetScaleY 0 we make sure to set the Scale back to 1 by issuing a SetScaleY 1

the Tread was set to 12 inches

the picked MoldSize was set to 3/4 inches by 3 inches

when we do z/3 it means each picket is spaced 4 inches apart

when we do Move 3 we're maling a 3 ft tall picket



curPosX, curPosY, curPosZ




the current  ( local ) translation controller settings for the extruder node


units are the centimeter


note that you can set the translation controllers using the SePosX, SetPosY, SetPosZ and MoveTo commands


many commands modify the curPos values: TransX TransY TransZ Turn TurnUp Twist( sloped ) etc ...


example: building dome supporting columns


     
  Profile square

var gridz 10

var spacing 1

var len 7


define acolumn x z

MoveTo (x-gridz/2)*spacing 0 (z-gridz/2)*spacing

Ring

set len sqrt(curPosX*curPosX+curPosZ*curPosZ+1)

Move len

Ring

endCap

break

defineEnd


rotateX -90

repeat gridz*gridz

var row Math.floor(count/gridz)

var col count%gridz

acolumn row col

repeatEnd


 
   
 



curAngX curAngY curAngZ




the current  ( local ) rotation controller settings for the extruder node


note that you can set the rotation controllers using the setRotX setRotY and setRotZ commands

Using the HardTurn, Rotate, RotateX, RotateZ, Turn, TurnUp and Twist commands also modifies them


 


curScaleX curScaleY curScaleZ


the current ( local ) scale controller settings for the extruder node


note that you can set the scale controllers using the SetScaleX, SetScaleY, SetScaleZ and SetScale commands




the current scale controller settings for the extruder node







PathCap


 Command  Alternate  Parameters  Description
 PathCap     creates a non-welded cap that covers the extrusion path


The caps are tesselated using the "ear clipping" method.

Tesselation is derived from c# code written by Bill Overman http://www.codeplex.com/PolygonTriangulation


Example:The PathCap Command

     
 

Profile square

Turn 360

pathCap



 
   
 






Var


 Command  Alternate  Parameters  Description
 Var  gVar
global
 name value creates a global variable - in future versions var will create
local variable when used inside a "define" block of commands.

See below the Set command which lets you modify your vars



Example:The Var Command
     
 

var bob 270

turn bob

break

MoveY 1

turn bob/2

 
   
 





Set


 Command  Alternate  Parameters  Description
 Set
name value changes the value of a variable that was declared using the Var command


Example:The Set Command
     
 

var bob 360

turn bob


break

MoveY 1


Set    bob    bob/3


turn bob

 
   
 






Trans TransX TransY TransZ

 Command  Alternate  Parameters  Description
 Trans    x y z  modifies the values of the nozzle's X, Y and Z translation controls
 this does not create a tube section it just moves the nozzle by x y z distances
 TransX    x  modifies  the values of the nozzle's X translation control
 this does not create a tube section it just moves the nozzle by distance x
 TransY    y  modifies  the values of the nozzle's Y translation control
 this does not create a tube section it just moves the nozzle by distance y
 TransZ    z  modifies  the values of the nozzle's Z translation control
 this does not create a tube section it just moves the nozzle by distance z

contrary to the Move commands, the movements are not relative to the current heading of the nozzle
the movements are not interacting with the Taper and Slope effects

Example:The Trans Commands

     
 

Profile square

MoldSize 1000 100

CloseProfile on

repeat    5
Ring

endCap
Move    1
Ring

break
TransY    1
repeatEnd


 
   
 






Comment / Description / //


 Command  Alternate  Parameters  Description
 // comment
description
..... everything on the same line as the comment command is ignored by the script
you can use this for personnal notes or to disable commands without deleting them



Example:The Comment Command
     
 

// un-comment the next line to force the use of the square profile


//profile square


var bob 270

turn bob

break

MoveY 1

turn bob/2


 
   
 





invertUVu


 Command  Alternate  Parameters  Description
 invertUVu
on/off true/false yes/no This corresponds to the "Invert Texture X" check-box, it mirrors the UV map horizontally.
Each object in a multi-object extrusion path can have its own UV map orientation

Depending on the chosen extrusion profile and path, the texture image may come out mirrored, 

This option will fix this by inverting the U's of the UV map



Example:The InvertUVu Command
     
 

define step

ring

Move 1

Ring

MoveY 1

defineEnd

invertUVu off

step

break

invertUVu on

step


 
   
 







RotateUVs


 Command  Alternate  Parameters  Description
 RotateUVs
on/off true/false yes/no swaps the U and V coordinates, resulting in a 90 degrees rotation of the UV map 

in the example, notice the use of a different Material for each mesh

this was necessary because the tiling was not 1x1


Example:The RotateUVs Command
     
 

define step

ring

Move 1

Ring

MoveY 1

defineEnd


Material ruvoff

rotateuvs off

step


break


Material ruvon

rotateuvs on

step


 
   
 







( DS-Nerd feature )
Full Daz Script Engine access
use of this feature requires knowledge of Daz Scripting though one could tweak the examples given here

In previous versions, mcjBuilder was using the eval() function to evaluate the statements in your scripts
it now creates a script based on your statement and executes it

so you can now do something like this ...

i get the position of Amy's head node and create a tube right in front of it


     
  var    x    Scene.findNodeByLabel("Amy").findBone("head").getWSPos().x
var    y    Scene.findNodeByLabel("Amy").findBone("head").getWSPos().y
var    z    Scene.findNodeByLabel("Amy").findBone("head").getWSPos().z
Tread    1
PathUnits    cm
MoveTo    x y z+30
Ring
MoveTo    x y z+100
Ring
 
   
 

you could even summon a script! ... if the path doesn't include blank spaces

you could also animate a null node

launch mcjBuilder

and use the positions of that node at different keyframes

Here i animated Amy's arm, from frames 0 to 10

i selected one of her finger tips

the script gets the positions of that finger tip and uses it t move the extrusion nozzle

"tick" is the animation frame duration

so when we get the position of the finger at 5*tick we are in fact getting the position of the finger at frame 5

quirk alert:

see the line 

var tick Scene.getTimeStep()+0

well without the "+0" part, ( in DS4.6 only )

the script was totally incapacitated




     
  var tick Scene.getTimeStep()+0

var pozX 0

var pozY 0

var pozZ 0


define getPoz i

set pozX Scene.getPrimarySelection().getWSPos(i*tick).x

set pozY Scene.getPrimarySelection().getWSPos(i*tick).y

set pozZ Scene.getPrimarySelection().getWSPos(i*tick).z

defineEnd


Tread 1

PathUnits cm


RotateY 90


repeat 30

getPoz count/6

MoveTo pozX pozY pozZ

Ring

repeatEnd


 
   
 









GetX GetY GetZ GetA



 Command  Alternate  Parameters  Description
 GetX
 idx returns the x component of the vertex position of a vertex of the currently selected mesh 
idx is the index of the vertex in the vertex collection
 GetY    idx  returns the y component of the vertex position of a vertex of the currently selected mesh 
idx is the index of the vertex in the vertex collection
 GetZ    idx  returns the z component of the vertex position of a vertex of the currently selected mesh 
idx is the index of the vertex in the vertex collection
 GetA    idx  returns the angle ( in degrees ) in the XZ plane for a vector going from vertex idx to vertex idx+1  of the selected mesh

The bodycon dress for Aiko 3 and the one for Genesis figures  ( found elsewhere on this site ) were built as a neatly ordered series of rings of 64 vertices

so if we create a tube going from the 1st vertex to the 64th vertex, we created a dress edge !


Example:The GetX GetY GetZ GetA commands
     
 

Profile t3

MoldSize 0.1 1

profileUnits cm

closeprofile on

PathUnits cm

Tread 1

ClosePath on


define makering i

MoveTo getX(i) getY(i) getZ(i)

SetRotY getA(i)

Ring

defineEnd


Repeat 64

makering count

repeatEnd


makering 0


 
   
 



NEW in BETA 9.0


Version 9.0 brings you 3 new functions, 

loadObj 

loadObj : lets you give a name to an .obj file ( a mesh in wavefront / obj format )

example

loadobj drop i:\z\halter.obj 

from now on when "drop" is mentionned it will be understood to be the file i:\z\halter.obj 

dropObj 

dropObj lets you insert position, rotate, scale the named mesh ( in an obj file ) at the current extruder's position, rotation and scale

example
dropobj drop

so the .obj file associated to this name will be added to your build at the current extruder position/rotation/scale


nomatObj

dropObj tells mcjBuilderA to ignore the material statements in the .obj file for the named mesh

this way the surfaces in the obj file will all be replaced by the current mcjBuilderA material

note: if you downloaded mcjBuilderA 9.0 around 6:23am on sept 16 ... there will be an update related to the setMat issue


example for the [ine tree above

PathUnits cm

radius 0.001

Tread 1

loadobj drop i:\z\halter.obj

repeat 96

SetscaleX (97-count)/25

dropobj drop

rotate 22.5

moveY 1.5

repeatend




NEW in the 6:47am version



the "material" command now works correctly with the loaded/dropped .obj





License

by mCasual/Jacques

You can use this software freely for personal or commercial use.

You may not sell, resell, sub-license or rent this software in any way.

you may credit this software to mCasual/Jacques

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




ċ
mCasual Jacques,
Nov 2, 2017, 2:58 PM
ċ
mcjBuilderABeta1.zip
(85k)
mCasual Jacques,
Apr 26, 2014, 5:22 PM
ċ
mcjBuilderABeta2.zip
(113k)
mCasual Jacques,
Apr 26, 2014, 5:22 PM
ċ
mcjBuilderABeta5.zip
(128k)
mCasual Jacques,
Apr 29, 2014, 6:35 AM
ċ
mcjBuilderABeta6.zip
(179k)
mCasual Jacques,
May 11, 2014, 9:00 PM
ċ
mcjBuilderABeta698.zip
(136k)
mCasual Jacques,
May 24, 2014, 10:28 AM
Ċ
mCasual Jacques,
May 12, 2014, 7:09 PM
ċ
mcjBuilderA_Beta_7.zip
(188k)
mCasual Jacques,
May 25, 2014, 8:51 PM
ċ
mcjBuilderA_Beta_8_1.zip
(173k)
mCasual Jacques,
May 16, 2017, 5:31 PM
ċ
mcjBuilderA_Beta_9_0.zip
(174k)
mCasual Jacques,
Sep 16, 2017, 3:47 AM
Comments