Patterns


Create grid or circular patterns using following function

pattern

Creates a pattern by applying series of transforms to a solid.

Syntax

cadlib.pattern(shapeToPattern, transforms);

Parameters

Name Type Description
shapeToPattern Solid Solid to use to create the pattern
transforms Array Array of Transforms.

Returns

Solid - Returned solid is a compound

Example

//pseudo code 


let transforms = [];

for(let i=0, i < 20; i++) {
    transforms.push( cadlib.createTranslationTransform() ); //create the points where shapeToPattern will be placed.
}

//Then create the pattern of <shapeToPattern> transformed according to the transforms array

let pattern = cadlib.pattern(cylinder, transform); 

//Can fuse the pattern with another solid
cadlib.fuse([baseSolid, pattern]);