diff --git a/.gitignore b/.gitignore index 5697b94..59414f8 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ Temporary Items *.json /Altium_Schematic_Parser.egg-info/ **/__Previews +**/Status Report.Txt +*.SchDoc.Zip diff --git a/README.md b/README.md index d200c7e..33516b7 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,16 @@ Converts Altium .SchDoc files into json cd Altium-Schematic-Parser pip install -e . ## Usage - python parse.py -i "path/to/altiumschematic.schdoc" -o "path/to/jsonfile.json" \ No newline at end of file + python parse.py -i "path/to/altiumschematic.schdoc" -o "path/to/jsonfile.json" +# Notes +## schdoc file format +Record ids: +* 1: a part +* 2: a pin on a part +* 6: a "drawing" I think... "Xn"/"Yn" are values of where a line should be drawn +* 41: text associated with a part - lots of different types indicated by "NAME" + * PinUniqueId: I suspect a unique id for the associated pin + * Fitted: ...wat? + * Comment: self explanatory +* 45: appears to be a reference to which "model" a particular part can be represented by. Since this is just a +possible model, the one actually selected for a given part will have the "ISCURRENT" flag set to "T" \ No newline at end of file diff --git a/parse.py b/parse.py index 6da61a7..962d930 100644 --- a/parse.py +++ b/parse.py @@ -74,6 +74,6 @@ if __name__ == "__main__": if args.output: json_file = open(args.output, 'w') - json.dump(schematic, json_file) + json.dump(schematic, json_file, indent=4) else: print(schematic) \ No newline at end of file diff --git a/tests/altium_crap/Snippets/Schematic/Free Documents.OutJob b/tests/altium_crap/Snippets/Schematic/Free Documents.OutJob new file mode 100644 index 0000000..5c9a173 --- /dev/null +++ b/tests/altium_crap/Snippets/Schematic/Free Documents.OutJob @@ -0,0 +1,148 @@ +[OutputJobFile] +Version=1.0 + +[OutputGroup1] +Name= +Description= +TargetOutputMedium=PDF +VariantName=[No Variations] +VariantScope=0 +CurrentConfigurationName= +TargetPrinter=Virtual Printer +PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputMedium1=Print Job +OutputMedium1_Type=Printer +OutputMedium1_Printer= +OutputMedium1_PrinterOptions=Record=PrinterOptions|Copies=1|Duplex=1|TrueTypeOptions=3|Collate=1|PrintJobKind=1|PrintWhat=1 +OutputMedium2=PDF +OutputMedium2_Type=Publish +OutputMedium3=Folder Structure +OutputMedium3_Type=GeneratedFiles +OutputMedium4=Video +OutputMedium4_Type=Multimedia +OutputType1=Schematic Print +OutputName1=Schematic Prints of Simple Regulator Circuit.SchDoc +OutputCategory1=Documentation +OutputDocumentPath1=Simple Regulator Circuit.SchDoc +OutputVariantName1= +OutputEnabled1=1 +OutputEnabled1_OutputMedium1=0 +OutputEnabled1_OutputMedium2=1 +OutputEnabled1_OutputMedium3=0 +OutputEnabled1_OutputMedium4=0 +OutputDefault1=0 +PageOptions1=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=0.94|XCorrection=1.00|YCorrection=1.00|PrintKind=0|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1 +Configuration1_Name1=OutputConfigurationParameter1 +Configuration1_Item1=Record=SchPrintView|ShowNoERC=True|ShowParamSet=True|ShowProbe=True|ShowBlanket=True|NoERCSymbolsToShow="Thin Cross","Thick Cross","Small Cross",Checkbox,Triangle|ShowNote=True|ShowNoteCollapsed=True|ShowOpenEnds=True|ExpandDesignator=True|ExpandNetLabel=False|ExpandPort=False|ExpandSheetNum=False|ExpandDocNum=False|PrintArea=0|PrintAreaRect.X1=0|PrintAreaRect.Y1=0|PrintAreaRect.X2=0|PrintAreaRect.Y2=0 +OutputType2=BOM_PartType +OutputName2=Bill of Materials +OutputCategory2=Report +OutputDocumentPath2= +OutputVariantName2=[No Variations] +OutputEnabled2=1 +OutputEnabled2_OutputMedium1=0 +OutputEnabled2_OutputMedium2=2 +OutputEnabled2_OutputMedium3=0 +OutputEnabled2_OutputMedium4=0 +OutputDefault2=0 +PageOptions2=Record=PageOptions|CenterHorizontal=True|CenterVertical=True|PrintScale=1.00|XCorrection=1.00|YCorrection=1.00|PrintKind=0|BorderSize=5000000|LeftOffset=0|BottomOffset=0|Orientation=2|PaperLength=1000|PaperWidth=1000|Scale=100|PaperSource=7|PrintQuality=-3|MediaType=1|DitherType=10|PrintScaleMode=1|PaperKind=Letter|PaperIndex=1 +Configuration2_Name1=ColumnNameFormat +Configuration2_Item1=CaptionAsName +Configuration2_Name2=General +Configuration2_Item2=TemplateFilename=Board Stack Report.XLT + +[PublishSettings] +OutputFilePath2=E:\GIT\Altium-Schematic-Parser\tests\altium_crap\Snippets\Schematic\.PDF +ReleaseManaged2=0 +OutputBasePath2=E:\GIT\Altium-Schematic-Parser\tests\altium_crap\Snippets\Schematic\ +OutputPathMedia2= +OutputPathMediaValue2= +OutputPathOutputer2=[Output Type] +OutputPathOutputerPrefix2= +OutputPathOutputerValue2= +OutputFileName2=Simple Regulator Circuit.pdf +OutputFileNameMulti2= +UseOutputNameForMulti2=1 +OutputFileNameSpecial2= +OpenOutput2=1 +PromptOverwrite2=1 +PublishMethod2=0 +ZoomLevel2=50 +FitSCHPrintSizeToDoc2=0 +FitPCBPrintSizeToDoc2=0 +GenerateNetsInfo2=1 +MarkPins2=1 +MarkNetLabels2=1 +MarkPortsId2=1 +GenerateTOC2=1 +ShowComponentParameters2=1 +GlobalBookmarks2=0 +PDFACompliance2=Disabled +PDFVersion2=Default +OutputFilePath3= +ReleaseManaged3=1 +OutputBasePath3= +OutputPathMedia3= +OutputPathMediaValue3= +OutputPathOutputer3=[Output Type] +OutputPathOutputerPrefix3= +OutputPathOutputerValue3= +OutputFileName3= +OutputFileNameMulti3= +UseOutputNameForMulti3=1 +OutputFileNameSpecial3= +OpenOutput3=1 +OutputFilePath4= +ReleaseManaged4=1 +OutputBasePath4= +OutputPathMedia4= +OutputPathMediaValue4= +OutputPathOutputer4=[Output Type] +OutputPathOutputerPrefix4= +OutputPathOutputerValue4= +OutputFileName4= +OutputFileNameMulti4= +UseOutputNameForMulti4=1 +OutputFileNameSpecial4= +OpenOutput4=1 +PromptOverwrite4=1 +PublishMethod4=5 +ZoomLevel4=50 +FitSCHPrintSizeToDoc4=1 +FitPCBPrintSizeToDoc4=1 +GenerateNetsInfo4=1 +MarkPins4=1 +MarkNetLabels4=1 +MarkPortsId4=1 +MediaFormat4=Windows Media file (*.wmv,*.wma,*.asf) +FixedDimensions4=1 +Width4=352 +Height4=288 +MultiFile4=0 +FramesPerSecond4=25 +FramesPerSecondDenom4=1 +AviPixelFormat4=7 +AviCompression4=MP42 MS-MPEG4 V2 +AviQuality4=100 +FFmpegVideoCodecId4=13 +FFmpegPixelFormat4=0 +FFmpegQuality4=80 +WmvVideoCodecName4=Windows Media Video V7 +WmvQuality4=80 + +[GeneratedFilesSettings] +RelativeOutputPath2=E:\GIT\Altium-Schematic-Parser\tests\altium_crap\Snippets\Schematic\.PDF +OpenOutputs2=1 +RelativeOutputPath3= +OpenOutputs3=1 +AddToProject3=1 +TimestampFolder3=0 +UseOutputName3=0 +OpenODBOutput3=0 +OpenGerberOutput3=0 +OpenNCDrillOutput3=0 +OpenIPCOutput3=0 +EnableReload3=0 +RelativeOutputPath4= +OpenOutputs4=1 + diff --git a/tests/altium_crap/Snippets/Schematic/simple regulator circuit.pdf b/tests/altium_crap/Snippets/Schematic/simple regulator circuit.pdf index 692d20b..e6eefe4 100644 Binary files a/tests/altium_crap/Snippets/Schematic/simple regulator circuit.pdf and b/tests/altium_crap/Snippets/Schematic/simple regulator circuit.pdf differ