Skip to main content
Version: Current

LDraw Actions

  • os.ldrawCountTextBuildSteps(address: string): Promise<number>

    Counts the number of build steps that exist in the given lego LDraw file. Returns a promise that resolves with the number of build steps.

    The first parameter is a string and is the address of the file.

    Examples
    Count the number of build steps in an example LDraw file
    const steps = await os.ldrawCountAddressBuildSteps('https://raw.githubusercontent.com/mrdoob/three.js/master/examples/models/ldraw/officialLibrary/models/car.ldr_Packed.mpd');
    os.toast("There are " + steps + " build steps in the file.");
    Animate the build steps of a bot
    const steps = await os.ldrawCountAddressBuildSteps('https://raw.githubusercontent.com/mrdoob/three.js/master/examples/models/ldraw/officialLibrary/models/car.ldr_Packed.mpd');
    for (let i = 0; i < steps; i++) {
    masks.formBuildStep = i;
    }