Material.py | Material.py | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |||
# * GNU Library General Public License for more details. * | # * GNU Library General Public License for more details. * | |||
# * * | # * * | |||
# * You should have received a copy of the GNU Library General Public * | # * You should have received a copy of the GNU Library General Public * | |||
# * License along with this program; if not, write to the Free Software * | # * License along with this program; if not, write to the Free Software * | |||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * | # * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * | |||
# * USA * | # * USA * | |||
# * * | # * * | |||
# ************************************************************************* ** | # ************************************************************************* ** | |||
import sys | ||||
# here the usage description if you use this tool from the command line ("_ _main__") | # here the usage description if you use this tool from the command line ("_ _main__") | |||
CommandlineUsage = """Material - Tool to work with FreeCAD Material definit ion cards | CommandlineUsage = """Material - Tool to work with FreeCAD Material definit ion cards | |||
Usage: | Usage: | |||
Material [Options] card-file-name | Material [Options] card-file-name | |||
Options: | Options: | |||
-c, --output-csv=file-name write a comma separated grid with the mater ial data | -c, --output-csv=file-name write a comma separated grid with the mater ial data | |||
Exit: | Exit: | |||
skipping to change at line 63 | skipping to change at line 65 | |||
def importFCMat(fileName): | def importFCMat(fileName): | |||
"Read a FCMat file into a dictionary" | "Read a FCMat file into a dictionary" | |||
try: | try: | |||
import ConfigParser as configparser | import ConfigParser as configparser | |||
except ImportError: | except ImportError: | |||
import configparser | import configparser | |||
Config = configparser.RawConfigParser() | Config = configparser.RawConfigParser() | |||
Config.optionxform = str | Config.optionxform = str | |||
Config.read(fileName, encoding='utf-8') # respect unicode filenames | if sys.version_info.major >= 3: | |||
Config.read(fileName, encoding='utf-8') # respect unicode filename | ||||
s | ||||
else: | ||||
Config.read(fileName) | ||||
dict1 = {} | dict1 = {} | |||
for section in Config.sections(): | for section in Config.sections(): | |||
options = Config.options(section) | options = Config.options(section) | |||
for option in options: | for option in options: | |||
dict1[option] = Config.get(section, option) | dict1[option] = Config.get(section, option) | |||
return dict1 | return dict1 | |||
def exportFCMat(fileName, matDict): | def exportFCMat(fileName, matDict): | |||
"Write a material dictionary to a FCMat file" | "Write a material dictionary to a FCMat file" | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |