{"script":"const { NGonWireDto, RotateDto, ScaleDto, LoftAdvancedDto, UnifySameDomainDto } = Bit.Inputs.OCCT;\nconst { PBRMetallicRoughnessDto } = Bit.Inputs.BabylonMaterial;\nconst { SkyboxDto } = Bit.Inputs.BabylonScene;\nconst { DrawOcctShapeOptions } = Bit.Inputs.Draw;\nconst { skyboxEnum } = Bit.Inputs.Base;\nconst { ZoomOnDto } = Bit.Advanced.Navigation;\nconst { approxParametrizationTypeEnum } = Bit.Inputs.OCCT;\ntype TopoDSShapePointer = Bit.Inputs.OCCT.TopoDSShapePointer;\n\nconst { wire, shape } = bitbybit.occt.shapes;\nconst { operations, transforms } = bitbybit.occt;\n\n\nconst skyboxOpt = new SkyboxDto();\nskyboxOpt.skybox = skyboxEnum.city;\nskyboxOpt.hideSkybox = true;\nbitbybit.babylon.scene.enableSkybox(skyboxOpt);\n\nconst nrCorners = 6;\n\n// 1. Create Base Wires\nconst ngonDto = new NGonWireDto();\nngonDto.nrCorners = nrCorners;\nngonDto.direction = [0, 1, 0];\nngonDto.radius = 1;\n\nngonDto.center = [0, 0, 0];\nconst wire1 = await wire.createNGonWire(ngonDto);\n\nngonDto.center = [0, 0.1, 0];\nconst wire2 = await wire.createNGonWire(ngonDto);\n\nngonDto.center = [0, 0.2, 0];\nconst wire3 = await wire.createNGonWire(ngonDto);\n\nngonDto.center = [0, 0.3, 0];\nconst wire4 = await wire.createNGonWire(ngonDto);\n\n// 2. Generate Lists of Transformed Wires\nconst list1: TopoDSShapePointer[] = [];\nconst list2: TopoDSShapePointer[] = [];\n\nfor (let i = 0; i <= 10; i++) {\n    const angle = i * 9;\n    const factor = i + 1;\n\n    // Helper to rotate and scale\n    const transform = async (w: TopoDSShapePointer) => {\n        const rotDto = new RotateDto<TopoDSShapePointer>();\n        rotDto.shape = w;\n        rotDto.axis = [0, 0, 1];\n        rotDto.angle = angle;\n        const rotated = await transforms.rotate(rotDto);\n\n        const scaleDto = new ScaleDto<TopoDSShapePointer>();\n        scaleDto.shape = rotated;\n        scaleDto.factor = factor;\n        return await transforms.scale(scaleDto);\n    };\n\n    list1.push(await transform(wire1));\n    list1.push(await transform(wire2));\n    list2.push(await transform(wire3));\n    list2.push(await transform(wire4));\n}\n\n// 3. Process Lists\n// Remove first item from list1\nlist1.shift();\n// Reverse list2 and remove last item\nlist2.reverse();\nlist2.shift();\nlist2.pop();\n\n// 4. Merge and Reverse Final List\n// Merge: list2 items then list1 items\nlet finalList = [...list2, ...list1];\n\n// Reverse the final list for the loft direction\nfinalList.reverse();\n\n// 5. Loft\nconst loftDto = new LoftAdvancedDto<TopoDSShapePointer>();\nloftDto.shapes = finalList;\nloftDto.makeSolid = false;\nloftDto.closed = true;\nloftDto.periodic = false;\nloftDto.straight = true;\nloftDto.nrPeriodicSections = 10;\nloftDto.useSmoothing = false;\nloftDto.maxUDegree = 3;\nloftDto.tolerance = 1e-7;\nloftDto.parType = approxParametrizationTypeEnum.approxCentripetal;\nconst loftShape = await operations.loftAdvanced(loftDto);\n\n// 6. Unify Domain\nconst unifyDto = new UnifySameDomainDto<TopoDSShapePointer>();\nunifyDto.shape = loftShape;\nunifyDto.unifyEdges = true;\nunifyDto.unifyFaces = true;\nunifyDto.concatBSplines = true;\nconst unifiedShape = await shape.unifySameDomain(unifyDto);\n\n// 7. Draw\nconst materialOptions = new PBRMetallicRoughnessDto();\nmaterialOptions.name = 'Custom Material';\nmaterialOptions.baseColor = '#94ffd1';\nmaterialOptions.emissiveColor = '#000000';\nmaterialOptions.metallic = 0.9;\nmaterialOptions.roughness = 0.3;\nmaterialOptions.alpha = 1;\nmaterialOptions.backFaceCulling = false;\nmaterialOptions.zOffset = 2;\nconst material = bitbybit.babylon.material.pbrMetallicRoughness.create(materialOptions);\n\nconst drawOptions = new DrawOcctShapeOptions();\ndrawOptions.precision = 0.01;\ndrawOptions.drawEdges = true;\ndrawOptions.edgeColour = '#ffffff';\ndrawOptions.edgeWidth = 2;\ndrawOptions.faceMaterial = material;\n\nconst drawnMesh = await bitbybit.draw.drawAnyAsync({\n    entity: unifiedShape,\n    options: drawOptions,\n});\n\nconst zoomDto = new ZoomOnDto();\nzoomDto.meshes = [drawnMesh];\nbitbybit.advanced.navigation.zoomOn(zoomDto);","version":"1.6.0","type":"typescript"}