User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
design_guide_parameters [2018/03/20 12:19]
z3dev
design_guide_parameters [2018/03/21 00:53]
z3dev
Line 7: Line 7:
 === Passing Options === === Passing Options ===
  
-JSCAD tries to maintain a consistent and easy to use set of functions (API). Although most functions require specific ​parameter and options, most are optionalEach function has predefined ​default values, even shapes (The defaults are shown along side of examples for each function.)+JSCAD tries to maintain a consistent and easy to use set of functions (API). Although most functions require specific options, most have defaults and do not need to be suppliedEvery function has predefined ​defaults, even shapes (The defaults are shown along side of examples for each function.)
  
 Options are passed as attributes of another object. In most cases, the options are assigned a value, and bracketed with ‘{…}’. Options are passed as attributes of another object. In most cases, the options are assigned a value, and bracketed with ‘{…}’.
Line 13: Line 13:
     cylinder({start:​ [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn: 50})     cylinder({start:​ [0,0,0], end: [0,0,10], r1: 1, r2: 2, fn: 50})
  
-Why the strange syntax? There can be lots parameters, ​and this provides a lot of flexibility when creating complex designs.+Why the strange syntax? There can be lots parameters, ​default parameters can be skipped, order is not important, etc. This provides a lot of flexibility when creating complex designs.
  
 === Passing Vectors === === Passing Vectors ===
  
 When 3D vectors are required, parameters can be passed as an array. If a scalar (single value) is passed for a parameter which expects a 3D vector, the scalar is used for the x, y and z values. In other words: radius: 1 will give radius: [1,1,1]. When 3D vectors are required, parameters can be passed as an array. If a scalar (single value) is passed for a parameter which expects a 3D vector, the scalar is used for the x, y and z values. In other words: radius: 1 will give radius: [1,1,1].