Python flat bill-of-material program based on Excel files - GitHub
文章推薦指數: 80 %
A Python program for flattening a layered bill-of-material (BOM) based on Excel files. Part quantities are combined and a total quantity or minimum-required- ... Skiptocontent {{message}} robsiegwart / python-BOM Public Notifications Fork 7 Star 9 Pythonflatbill-of-materialprogrambasedonExcelfiles License MITlicense 9 stars 7 forks Star Notifications Code Issues 0 Pullrequests 0 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights robsiegwart/python-BOM Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 1 branch 0 tags Code Clone HTTPS GitHubCLI UseGitorcheckoutwithSVNusingthewebURL. WorkfastwithourofficialCLI. Learnmore. OpenwithGitHubDesktop DownloadZIP LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingGitHubDesktop Ifnothinghappens,downloadGitHubDesktopandtryagain. LaunchingXcode Ifnothinghappens,downloadXcodeandtryagain. LaunchingVisualStudioCode Yourcodespacewillopenonceready. Therewasaproblempreparingyourcodespace,pleasetryagain. Latestcommit RobSiegwart UpdateREADME … 987a69e Aug31,2021 UpdateREADME 987a69e Gitstats 58 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime Example doc pyBOM .gitignore LICENSE README.md setup.py Viewcode pyBOM Motivation Structure Usage CommandLine Dependencies README.md pyBOM APythonprogramforflatteningalayeredbill-of-material(BOM)basedonExcel files.Partquantitiesarecombinedandatotalquantityor minimum-required-package-to-buyamountiscalculated,inadditiontoextended costs.AtreestructureoftheBOMhierarchycanalsobecreatedandconverted toDOTsyntaxforfurthergraphicsgeneration. Motivation Themainproblemsolvedistocombineidenticalpartsfromvarious sub-assembliesandlocationsinyourproductBOM.Additionally,itistobeused withExcelsinceExceliscommon,easy,anddoesnotrequireaseparateprogram orservertorun.FlatteningtellsyouthetotalQTYofapartwhenitmaybe usedinmanysub-assembliesandlevelsinyourproductstructure.Thisis necessarytocalculatethetotalQTYofapartandthereforedeterminethe mininumpackagesoftheproducttobuy,sincemanypartscomeinpacksgreater thanQTY1. Structure BOMsarecreatedbystoringpartsandassembliesinExcelfiles. Inaseparatedirectory,putanExcelfilenamedPartslist.xlsxtoserveas themasterpartslist"database".Then,eachadditionalassemblyisdescribed byaseparate.xlsxfile.Thusyoumighthave: my_project/ Partslist.xlsx>>print(bom.parts) [PartSK1002-01,PartSK1005-01,PartSK1007-01] BOM.assemblies :Getalistofalldirect-childassemblies >>>print(bom.assemblies) [WH-01,TR-01] BOM.quantities :Getthequantityofeachdirect-childpartintheBOM >>>print(bom.quantities) {PartSK1002-01:1,PartSK1005-01:1,PartSK1007-01:3,PartSK1006-01:1, PartSK1001-01:1,PartSK1003-01:1,PartSK1004-01:1} BOM.aggregate :Gettheaggregatedquantityofeachpart/assemblyfromthecurrent BOMleveldown >>>print(bom.aggregate) {PartSK1002-01:1,PartSK1005-01:8,PartSK1007-01:14,PartSK1006-01:8, PartSK1001-01:4,PartSK1003-01:2,PartSK1004-01:2} BOM.summary :GetasummaryintheformofaDataFramecontainingthemasterparts listwitheachitem'saggregatedquantityandtherequiredpackages tobuyifthePkgQTYfieldisnot1. >>>print(bom.summary) PNNameDescription...TotalQTYPurchaseQTYSubtotal 0SK1001-01BearingWheelbearing...4411.96 1SK1002-01BoardStandardtype...1113.42 2SK1003-01TruckhalfTruckfixed...2219.74 3SK1004-01TruckhalfTruckmovable...2224.50 4SK1005-01Truckscrew1/4-20SHCS...8112.86 5SK1006-01WheelHardclearurethane...8219.74 6SK1007-01Nut1/4-20Hexnut...1414.88 BOM.tree :ReturnastringrepresentationoftheBOMtreehierarchy >>>print(bom.tree) SKA-100 ├──PartSK1002-01 ├──WH-01 │├──PartSK1006-01 │├──PartSK1001-01 │└──PartSK1007-01 ├──TR-01 │├──PartSK1003-01 │├──PartSK1004-01 │└──PartSK1007-01 ├──PartSK1005-01 └──PartSK1007-01 Callingthisonchildassembliesshowsthetreefromthatreferencepoint: >>>sa=bom.assemblies[0] >>>sa WH-01 >>>print(sa.tree) WH-01 ├──PartSK1006-01 ├──PartSK1001-01 └──PartSK1007-01 CommandLine Somequickfunctionalityisextendedtothecommandlineviapythonmodulemode: >python-mpyBOMFOLDERACTION WhereACTIONiswhattodoandisjustapropertycallontheresulting top-levelBOM: >python-mpyBOMExampletree SKA-100 ├──PartSK1002-01 ├──WH-01 │├──PartSK1006-01 │├──PartSK1001-01 │└──PartSK1007-01 ├──TR-01 │├──PartSK1003-01 │├──PartSK1004-01 │└──PartSK1007-01 ├──PartSK1005-01 └──PartSK1007-01 Dependencies pandas anytree About Pythonflatbill-of-materialprogrambasedonExcelfiles Resources Readme License MITlicense Stars 9 stars Watchers 1 watching Forks 7 forks Releases Noreleasespublished Packages0 Nopackagespublished Languages Python 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.
延伸文章資訊
- 1BOM 的去除方式:分別使用vim, Python, 及bash - Kirin
BOM 的去除方式:分別使用vim, Python, 及bash. 0. Kirin written 10 個月ago. 最後更新日期:2022 年01 月3 日. BOM 是Byte Orde...
- 2[python] 解決生成csv file編碼問題(with BOM) - JysBlog
當我們使用UTF-8生成csv時,並未在header生成BOM訊息,所以Excel會依照Unicode編碼讀取,就會有亂碼產生。 實作. 下面是簡單的生成csv的python程式:.
- 3Python 學習筆記: 文字檔的BOM 問題 - 小狐狸事務所
這個BOM 問題是我在母校圖書館借的"Python 零基礎入門班 (碁峰2018, 文淵閣工作室) " 這本書中看到的, 裡面提到在Windows 系統下將檔案存成utf-8 編碼 ...
- 4python 讀取帶BOM的utf-8格式檔案 - 程式人生
微軟在UTF-8中使用BOM(Byte order mark)是因為這樣可以將UTF-8和ASCII等 ... 比如很多現代指令碼語言,例如python,其直譯器本身是能處理BOM的, ...
- 5cyclonedx-bom - PyPI
CycloneDX Python SBOM Generation Tool ... This project provides a runnable Python-based applicati...