@@ -908,6 +908,7 @@ def rows_to_symbol(
908908 ccw = False ,
909909 hide_pin_num = False ,
910910 bundle_style = "count" ,
911+ justify = "right" ,
911912):
912913 """
913914 Generate a KiCad symbol S-expression from CSV rows.
@@ -949,6 +950,8 @@ def rows_to_symbol(
949950 hide_pin_num (bool, optional): Hide pin number. Defaults to False.
950951 bundle_style (str, optional): When bundling pins, selects what is appended to the net name.
951952 Can be none, count, or range. Defaults to count.
953+ justify (str, optional): Sets the justification on visible properties.
954+ Can be left, center, or right. Defaults to right.
952955
953956 Returns:
954957 Sexp: KiCad symbol as an Sexp object, ready to be included in a library.
@@ -979,8 +982,8 @@ def rows_to_symbol(
979982 # Enter default properties. User-specified property values will override these.
980983 # The entries in the property list are [value, x_offset, y_offset, text justification, hidden].
981984 properties = {
982- "Reference" : ["U" , 0 , 2.5 * GRID_SPACING , "right" , "no" ],
983- "Value" : [part_name , 0 , 0.5 * GRID_SPACING , "right" , "no" ],
985+ "Reference" : ["U" , 0 , 2.5 * GRID_SPACING , justify , "no" ],
986+ "Value" : [part_name , 0 , 0.5 * GRID_SPACING , justify , "no" ],
984987 "Footprint" : ["" , 0 , 0 , "right" , "yes" ],
985988 "Datasheet" : ["" , 0 , 0 , "right" , "yes" ],
986989 "Description" : ["" , 0 , 0 , "left" , "yes" ],
@@ -1422,6 +1425,7 @@ def rows_to_symbol_lib(
14221425 hide_pin_num = False ,
14231426 one_symbol = False ,
14241427 bundle_style = "count" ,
1428+ justify = "right" ,
14251429):
14261430 """
14271431 Generate a complete KiCad symbol library from CSV or Excel data.
@@ -1462,6 +1466,8 @@ def rows_to_symbol_lib(
14621466 Defaults to False.
14631467 bundle_style (str, optional): When bundling pins, selects what is appended to the net name.
14641468 Can be none, count, or range. Defaults to count.
1469+ justify (str, optional): Sets the justification on visible properties.
1470+ Can be left, center, or right. Defaults to right.
14651471
14661472 Returns:
14671473 Sexp: Complete KiCad symbol library as an Sexp object, ready to write to file.
@@ -1493,6 +1499,7 @@ def rows_to_symbol_lib(
14931499 push = push ,
14941500 hide_pin_num = hide_pin_num ,
14951501 bundle_style = bundle_style ,
1502+ justify = justify ,
14961503 )
14971504 symbol_lib .append (symbol )
14981505 except Exception as e :
@@ -1530,6 +1537,7 @@ def row_file_to_symbol_lib_file(
15301537 hide_pin_num = False ,
15311538 one_symbol = False ,
15321539 bundle_style = "count" ,
1540+ justify = "right" ,
15331541):
15341542 """
15351543 Convert a CSV or Excel file to a KiCad symbol library file.
@@ -1576,6 +1584,8 @@ def row_file_to_symbol_lib_file(
15761584 Defaults to False.
15771585 bundle_style (str, optional): When bundling pins, selects what is appended to the net name.
15781586 Can be none, count, or range. Defaults to count.
1587+ justify (str, optional): Sets the justification on visible properties.
1588+ Can be left, center, or right. Defaults to right.
15791589
15801590 Returns:
15811591 str: Path to the generated .kicad_sym file.
@@ -1615,6 +1625,7 @@ def row_file_to_symbol_lib_file(
16151625 hide_pin_num = hide_pin_num ,
16161626 one_symbol = one_symbol ,
16171627 bundle_style = bundle_style ,
1628+ justify = justify ,
16181629 )
16191630
16201631 # If the output file already exists and overwrite is True, we need to merge
@@ -1839,6 +1850,13 @@ def kipart():
18391850 action = "store_true" ,
18401851 help = "Hide pin numbers" ,
18411852 )
1853+ parser .add_argument (
1854+ "-j" ,
1855+ "--justify" ,
1856+ choices = ["left" , "center" , "right" ],
1857+ default = "right" ,
1858+ help = "Sets the justification on visible properties" ,
1859+ )
18421860 parser .add_argument (
18431861 "-v" , "--version" , action = "version" , version = f"%(prog)s { __version__ } "
18441862 )
@@ -1919,6 +1937,7 @@ def kipart():
19191937 hide_pin_num = args .hide_pin_num ,
19201938 one_symbol = args .one_symbol ,
19211939 bundle_style = args .bundle_style ,
1940+ justify = args .justify ,
19221941 )
19231942
19241943 if args .merge :
0 commit comments