youssefbrini / Push Button B3FS-1050P

Files

Pins

Symbol

PCB

Open in Flux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const modelNode = flux.getNodeById("78d1cf24-a3f9-242e-2f62-c2bacd49dcde") as PcbLayoutNode;
// This will sort and return an array of all available assets in the project with file type .step
const modelAssetIdNotSorted = flux.assets.filter((asset) => asset.fileType === "step").map((asset) => asset.name);
const modelAssetId = modelAssetIdNotSorted.sort();
const assetModelRule = modelNode.rules.find((rule) => rule.key === "asset");
/////////////////////////////////////////////////////////
const pin1Id = "0860dc5d-facf-3e33-1d57-6791399c1fa3";
const pin2Id = "020cf3fc-777c-d543-49b3-8c4a9fc59854";
const pin1 = flux.getNodeById(pin1Id, "elementTerminal");
const pin2 = flux.getNodeById(pin2Id, "elementTerminal");
const pushSwitch = flux.controls.find(control => control.name === "Momentary Switch");
flux.on("setup", () => {
    if (pushSwitch) {
        flux.currentSymbol = "push-button-closed";
        flux.simulationModel = simModel(Boolean(true));
    } else {
        flux.currentSymbol = "push-button-open";
        flux.simulationModel = simModel(Boolean(false));
    }
});
flux.on("inputChange", (e) => {
    if (e.control_name === "Momentary Switch") {
        if (e.value === "closed") {
            flux.currentSymbol = "push-button-closed";
            flux.simulationModel = simModel(Boolean(true));
Enter to Rename, Shift+Enter to Preview

Reviews