inventree
This is an old revision of the document!
Inventree
Used plugins
- inventree-kicad-plugin
- inventree-bulk-plugin
- inventree-ipn-generator
Inventree Bulk Plugin
Generate resistors
{"name":"","template_type":"PART","template":{"version":"1.2.3","input":{"firstDecade":"-2","tolerance":"5","decimalPlacesInBaseValues":"2","unitLetter":"Q"},"templates":[],"output":{"parent_name_match":"true","dimensions":["1.33, 1.40, 1.47","*NUMERIC","0603"],"count":["","3",""],"generate":{"name":"RES SMD {{global.descriptionValueStr}} OHM {{inp.tolerance}}% {{global.power}}W {{dim.3}}","parameters":[{"template":"1","value":"{{global.titleValueStr}}"}]},"global_context":"{# Prepare lookup tables #}\n{% set prefixes = {-4: 'p', -3: 'n', -2: 'u', -1: 'm', 0: inp.unitLetter, 1: 'k', 2: 'M', 3: 'G', 4: 'T'} %}\n\n{# Prepare arguments and dimensions #}\n{% set baseValue = dim.1|float %}\n{% set decade = (dim.2|int-1)+(inp.firstDecade|int) %}\n\n{# Calculate which prefix we are having #}\n{% set prefixIndex = decade//3 %}\n{% set prefix = prefixes[prefixIndex] %}\n\n{# Calculate values for different text formattings and round them to avoid float artifacts #}\n{% set actualValue = (baseValue * 10 ** decade)|round(inp.decimalPlacesInBaseValues|int -decade) %}\n{% set prefixedValue = (baseValue * 10 ** (decade % 3))|round(inp.decimalPlacesInBaseValues|int) %}\n\n{# Format a string for the value in my personal prefered format #}\n{% set titleValueStr = prefixedValue|string|replace('.',prefix)|trim('0') %}\n\n{# Format a string for the value in DigiKeys description format#}\n{# The adding of the @ sign is just an ugly way of inventing trim trailing characters.. #}\n{% if decade < 3 %}\n{% set descriptionValueStr = ('@'+actualValue|string)|trim('0')|trim('.')|trim('@') %}\n{% else %}\n{% set descriptionValueStr = ('@'+prefixedValue|string)|trim('0')|trim('.')|trim('@') + prefix %}\n{% endif %}\n\n{% set power = 0.1 %}"}}}
Working config
## Last bit of .env file ## # Site URL - update this to match your host (and update the Caddyfile too!) INVENTREE_SITE_URL="https://parts.jegatron.se" INVENTREE_ALLOWED_HOSTS=parts.jegatron.se,toast.home.arpa INVENTREE_TRUSTED_ORIGINS=https://parts.jegatron.se #INVENTREE_CORS_ORIGIN_ALLOW_ALL=True INVENTREE_CORS_ALLOW_CREDENTIALS=True INVENTREE_USE_X_FORWARDED_HOST=True #INVENTREE_USE_X_FORWARDED_PORT=True #INVENTREE_CORS_ORIGIN_REGEX=.*jegatron.se
## Single line change of Caddyfile ##
# Change the host to your domain (this will serve at inventree.localhost)
toast.home.arpa {
## NginxProxyManager custom config box ##
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
add_header X-Served-By parts.jegatron.se;
proxy_set_header Host toast.home.arpa;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass https://toast.home.arpa:443$request_uri;
proxy_ssl_name toast.home.arpa;
proxy_ssl_server_name on;
#proxy_ssl_session_reuse off;
#proxy_ssl_trusted_certificate /data/custom_ssl/toast.home.arpa.pem;
#proxy_ssl_verify off;
}
inventree.1714816515.txt.gz · Last modified: 2024/05/04 09:55 by utedass
