From 6a3a3f9f3e4a14db8b92a0abc9d040a6718308eb Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Fri, 1 Mar 2019 21:01:40 +0100 Subject: [PATCH] Material: mat module, write all cards def, add a parameter to not write the template card, which is active by default --- src/Mod/Material/Material.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Mod/Material/Material.py b/src/Mod/Material/Material.py index 32c6e4d1f4..f85c7c106d 100644 --- a/src/Mod/Material/Material.py +++ b/src/Mod/Material/Material.py @@ -139,16 +139,19 @@ def read_cards_from_path(cards_path): return mat_cards -def write_cards_to_path(cards_path, cards_data, write_group_section=True): +def write_cards_to_path(cards_path, cards_data, write_group_section=True, write_template=False): from importFCMat import write from os.path import join for card_data in cards_data: - card_path = join(cards_path, (card_data['CardName'] + '.FCMat')) - print(card_path) - if write_group_section is True: - write(card_path, card_data, True) + if (card_data['CardName'] == 'TEMPLATE') and (write_template is False): + continue else: - write(card_path, card_data, False) + card_path = join(cards_path, (card_data['CardName'] + '.FCMat')) + print(card_path) + if write_group_section is True: + write(card_path, card_data, True) + else: + write(card_path, card_data, False) if __name__ == '__main__':