Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- web

nimble_cadorch_server:
build: .
image: nimble_cadorch_server:latest # your image
container_name: nimble_cadorch_server
restart: unless-stopped
Expand Down
18 changes: 9 additions & 9 deletions generate_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
from nimble_build_system.cad.shelf import create_shelf_for


BUILD_DIR = ABS_PATH
BUILD_DIR = ABS_PATH

logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s\t %(levelname)s:\t %(filename)s\t %(funcName)s:\t %(message)s",
force=True)


def Main():
def main():
"""
Main script function. Gets a list of printed components (legs and shelves)
and uses the orchestration runner to build them
"""

components = GetComponentList()
Generator(components, Settings(), BUILD_DIR)
OutputStaticSite(components['components'])
components = get_component_list()
Generator.run(components, Settings(), BUILD_DIR)
output_static_site(components['components'])


def TempDir():
def temp_dir():
"""
Creates a directory under temporary file system:
in Linux at: "/tmp/"
Expand All @@ -51,7 +51,7 @@ def TempDir():
return location


def GetComponentList():
def get_component_list():
"""
Generate the component list. This is 4 types of legs and some
shelves
Expand All @@ -74,7 +74,7 @@ def GetComponentList():
return {'device-ids':component_list, 'components':components}


def OutputStaticSite(components):
def output_static_site(components):
"""
Create a sumple web page (index.html) with links to all generated files
"""
Expand Down Expand Up @@ -120,4 +120,4 @@ def OutputStaticSite(components):


if __name__ == "__main__":
Main()
main()
31 changes: 26 additions & 5 deletions nimble_build_system/utils/gen_nimble_conf_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
import sys
import json
import re
from .nimble_devices_updater import main as update_devices_json


def usage():
"""
Prints a usage message for this utility.
"""
print("gen_nimble_conf_options")
print("This utility exists to generate config options for CadOrchestrator")
print("using devices.json")
print("Usage:")
print(" gen_nimble_conf_options")


def main():
"""
Expand All @@ -26,11 +29,22 @@ def main():

if not os.path.exists('devices.json'):
print("Error. devices.json not found")
print("Attempting to update devices.json from remote source...")
try:
update_devices_json()
print("devices.json updated successfully.")
except RuntimeError as e:
print(f"Failed to update devices.json: {e}")
sys.exit(1)
# Write the JSON data to file

usage()

# Write the JSON data to a file.
with open('devices.json', 'r', encoding="utf-8") as dev_file:
devices = json.load(dev_file)



access_points = []
routers = []
servers = []
Expand All @@ -52,9 +66,12 @@ def main():

# Added If statement filtering only '6 in' Rack label items,
# fixing big boxes with render issues.
if device['Rack'] != '6 in':
# This avois placing Racks different by '6 in' in the devices.json
continue
allowed = ['6in']
print("Allowed device sizes: ",allowed)

for dev in allowed:
if device['Rack'] != dev:
continue

item = {'value': device['ID'],
'name': device['Brand']+" "+device['Hardware']}
Expand Down Expand Up @@ -97,9 +114,13 @@ def main():
}
]}

print(f"Generated config options for \
{len(access_points)+len(routers)+len(servers)+len(switches)} devices.")

with open('OrchestratorConfigOptions.json', 'w', encoding="utf-8") as conf_file:
json.dump(conf_dict, conf_file)

print("Wrote OrchestratorConfigOptions.json")

def shelf_available(device):
"""
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ attrs==25.3.0
backports-datetime-fromisoformat==2.0.3
blinker==1.9.0
Brotli==1.1.0
cadorchestrator @ git+https://gitlab.com/gitbuilding/cadorchestrator.git@a0bbf009b968970add7e3574497298c109e8ce3f
cadorchestrator @ git+https://gitlab.com/gitbuilding/cadorchestrator.git@master
cadquery==2.4.0
cadquery-ocp==7.7.2.2b2
cadquery_freecad_import_plugin>=1.0.0
cadquery_png_plugin>=1.0.2
cadquery_png_plugin==1.0.2
cadscript>=0.5.3
casadi>=3.7.1
certifi==2025.8.3
Expand Down