Material: Created material editor

Materal editor is now funcional, abeit not complete. Can be used to
create and save new cards. Lauch from within FreeCAD with
import MaterialEditor; MaterialEditor.openEditor()
This commit is contained in:
Yorik van Havre 2013-11-19 19:27:15 -02:00
parent c01306440a
commit f4da53bd1d
7 changed files with 1212 additions and 128 deletions

View File

@ -4,6 +4,7 @@ SET(Material_SRCS
InitGui.py
Material.py
importFCMat.py
MaterialEditor.py
)
SOURCE_GROUP("" FILES ${Material_SRCS})
@ -34,3 +35,11 @@ INSTALL(
FILES ${Material_SRCS}
DESTINATION Mod/Material
)
INSTALL(
DIRECTORY
StandardMaterial
DESTINATION
${CMAKE_INSTALL_DATADIR}/Mod/Material
FILES_MATCHING PATTERN "*.FCMat*"
)

View File

@ -0,0 +1,239 @@
#***************************************************************************
#* *
#* Copyright (c) 2013 - Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import FreeCAD, os
from PyQt4 import QtCore, QtGui, uic
__title__="FreeCAD material editor"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
class MaterialEditor(QtGui.QDialog):
def __init__(self, obj = None, prop = None):
"Initializes, optionally with an object name and a material property name to edit"
QtGui.QDialog.__init__(self)
self.obj = obj
self.prop = prop
self.customprops = []
# load the UI file from the same directory as this script
uic.loadUi(os.path.dirname(__file__)+os.sep+"materials-editor.ui",self)
self.ui = self
# additional UI fixes and tweaks
self.ButtonURL.setIcon(QtGui.QIcon(":/icons/internet-web-browser.svg"))
self.ButtonDeleteProperty.setEnabled(False)
self.standardButtons.button(QtGui.QDialogButtonBox.Ok).setAutoDefault(False)
self.standardButtons.button(QtGui.QDialogButtonBox.Cancel).setAutoDefault(False)
self.updateCards()
self.Editor.header().resizeSection(0,200)
self.Editor.expandAll()
self.Editor.setFocus()
# TODO allow to enter a custom property by pressing Enter in the lineedit (currently closes the dialog)
self.Editor.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
QtCore.QObject.connect(self.ComboMaterial, QtCore.SIGNAL("currentIndexChanged(QString)"), self.updateContents)
QtCore.QObject.connect(self.ButtonURL, QtCore.SIGNAL("clicked()"), self.openProductURL)
QtCore.QObject.connect(self.standardButtons, QtCore.SIGNAL("accepted()"), self.accept)
QtCore.QObject.connect(self.standardButtons, QtCore.SIGNAL("rejected()"), self.reject)
QtCore.QObject.connect(self.ButtonAddProperty, QtCore.SIGNAL("clicked()"), self.addCustomProperty)
QtCore.QObject.connect(self.EditProperty, QtCore.SIGNAL("returnPressed()"), self.addCustomProperty)
QtCore.QObject.connect(self.ButtonDeleteProperty, QtCore.SIGNAL("clicked()"), self.deleteCustomProperty)
QtCore.QObject.connect(self.Editor, QtCore.SIGNAL("itemDoubleClicked(QTreeWidgetItem*,int)"), self.itemClicked)
QtCore.QObject.connect(self.Editor, QtCore.SIGNAL("currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)"), self.checkDeletable)
QtCore.QObject.connect(self.ButtonOpen, QtCore.SIGNAL("clicked()"), self.openfile)
QtCore.QObject.connect(self.ButtonSave, QtCore.SIGNAL("clicked()"), self.savefile)
# update the editor with the contents of the property, if we have one
if self.prop and self.obj:
d = FreeCAD.ActiveDocument.getObject(self.obj).getPropertyByName(self.prop)
self.updateContents(d)
def updateCards(self):
"updates the contents of the materials combo with existing material cards"
# look for cards in both resources dir and user folder.
# User cards with same name will override system cards
paths = [FreeCAD.getResourceDir() + os.sep + "Mod" + os.sep + "Material" + os.sep + "StandardMaterial"]
paths.append(FreeCAD.ConfigGet("UserAppData"))
self.cards = {}
for p in paths:
for f in os.listdir(p):
b,e = os.path.splitext(f)
if e.upper() == ".FCMAT":
self.cards[b] = p + os.sep + f
if self.cards:
self.ComboMaterial.clear()
self.ComboMaterial.addItem("") # add a blank item first
for k,i in self.cards.iteritems():
self.ComboMaterial.addItem(k)
def updateContents(self,data):
"updates the contents of the editor with the given data (can be the name of a card or a dictionary)"
if isinstance(data,dict):
self.clearEditor()
for k,i in data.iteritems():
k = self.expandKey(k)
slot = self.Editor.findItems(k,QtCore.Qt.MatchRecursive,0)
if len(slot) == 1:
slot = slot[0]
slot.setText(1,i)
else:
self.addCustomProperty(k,i)
elif isinstance(data,QtCore.QString):
k = str(data)
if k:
if k in self.cards:
import importFCMat
d = importFCMat.read(self.cards[k])
if d:
self.updateContents(d)
def openProductURL(self):
"opens the contents of the ProductURL field in an external browser"
url = str(self.Editor.findItems(translate("Material","Product URL"),QtCore.Qt.MatchRecursive,0)[0].text(1))
if url:
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode))
def accept(self):
"if we are editing a property, set the property values"
if self.prop and self.obj:
d = self.getDict()
o = FreeCAD.ActiveDocument.getObject(self.obj)
setattr(o,self.prop,d)
QtGui.QDialog.accept(self)
def expandKey(self, key):
"adds spaces before caps in a KeyName"
nk = ""
for l in key:
if l.isupper():
if nk:
# this allows for series of caps, such as ProductURL
if not nk[-1].isupper():
nk += " "
nk += l
return nk
def collapseKey(self, key):
"removes the spaces in a Key Name"
nk = ""
for l in key:
if l != " ":
nk += l
return nk
def clearEditor(self):
"Clears the contents of the editor"
for i1 in range(self.Editor.topLevelItemCount()):
w = self.Editor.topLevelItem(i1)
for i2 in range(w.childCount()):
c = w.child(i2)
c.setText(1,"")
for k in self.customprops:
self.deleteCustomProperty(k)
def addCustomProperty(self, key = None, value = None):
"Adds a custom property to the editor, optionally with a value"
if not key:
key = str(self.EditProperty.text())
if key:
if not key in self.customprops:
if not self.Editor.findItems(key,QtCore.Qt.MatchRecursive,0):
top = self.Editor.findItems(translate("Material","User defined"),QtCore.Qt.MatchExactly,0)
if top:
i = QtGui.QTreeWidgetItem(top[0])
i.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEditable|QtCore.Qt.ItemIsDragEnabled|QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled)
i.setText(0,key)
self.customprops.append(key)
self.EditProperty.setText("")
if value:
i.setText(1,value)
def deleteCustomProperty(self, key = None):
"Deletes a custom property from the editor"
if not key:
key = str(self.Editor.currentItem().text(0))
if key:
if key in self.customprops:
i = self.Editor.findItems(key,QtCore.Qt.MatchRecursive,0)
if i:
top = self.Editor.findItems(translate("Material","User defined"),QtCore.Qt.MatchExactly,0)
if top:
top = top[0]
ii = top.indexOfChild(i[0])
if ii >= 0:
top.takeChild(ii)
self.customprops.remove(key)
def itemClicked(self, item, column):
"Edits an item if it is not in the first column"
if column > 0:
self.Editor.editItem(item, column)
def checkDeletable(self,current,previous):
"Checks if the current item is a custom property, if yes enable the delete button"
if str(current.text(0)) in self.customprops:
self.ButtonDeleteProperty.setEnabled(True)
else:
self.ButtonDeleteProperty.setEnabled(False)
def getDict(self):
"returns a dictionnary from the contents of the editor"
d = {}
for i1 in range(self.Editor.topLevelItemCount()):
w = self.Editor.topLevelItem(i1)
for i2 in range(w.childCount()):
c = w.child(i2)
# TODO the following should be translated back to english,since text(0) could be translated
d[self.collapseKey(str(c.text(0)))] = unicode(c.text(1))
return d
def openfile(self):
"Opens a FCMat file"
filename = QtGui.QFileDialog.getOpenFileName(QtGui.qApp.activeWindow(),'Open FreeCAD Material file','*.FCMat')
if filename:
self.clearEditor()
import importFCMat
d = importFCMat.read(filename)
if d:
self.updateContents(d)
def savefile(self):
"Saves a FCMat file"
name = str(self.Editor.findItems(translate("Material","Name"),QtCore.Qt.MatchRecursive,0)[0].text(1))
if not name:
name = "Material"
filename = QtGui.QFileDialog.getSaveFileName(QtGui.qApp.activeWindow(),'Save FreeCAD Material file',name+'.FCMat')
if filename:
d = self.getDict()
if d:
import importFCMat
importFCMat.write(filename,d)
def translate(context,text):
"translates text"
return text #TODO use Qt translation mechanism here
def openEditor(obj = None, prop = None):
"""openEditor([obj,prop]): opens the editor, optionally with
an object name and material property name to edit"""
editor = MaterialEditor(obj,prop)
editor.show()

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="96"
height="96"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="New document 1">
<defs
id="defs4">
<linearGradient
id="linearGradient3755">
<stop
style="stop-color:#424242;stop-opacity:1;"
offset="0"
id="stop3757" />
<stop
style="stop-color:#9f9f9f;stop-opacity:1;"
offset="1"
id="stop3759" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3755"
id="linearGradient3761"
x1="75.724594"
y1="85.023956"
x2="41.895164"
y2="13.334851"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="7.9195959"
inkscape:cx="45.182954"
inkscape:cy="48.588533"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
showborder="true"
inkscape:window-width="1920"
inkscape:window-height="1053"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-956.36218)">
<path
sodipodi:type="arc"
style="color:#000000;fill:url(#linearGradient3761);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.29399991000000014;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path2985"
sodipodi:cx="56.785713"
sodipodi:cy="50.107143"
sodipodi:rx="39.464287"
sodipodi:ry="39.464287"
d="m 96.25,50.107143 a 39.464287,39.464287 0 1 1 -78.928574,0 39.464287,39.464287 0 1 1 78.928574,0 z"
transform="matrix(1.0586387,0,0,1.0586387,-13.061986,951.19181)" />
<path
sodipodi:type="arc"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.29399991;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
id="path3771"
sodipodi:cx="41.42857"
sodipodi:cy="41.625"
sodipodi:rx="20.892857"
sodipodi:ry="8.8392859"
d="m 62.321426,41.625 a 20.892857,8.8392859 0 1 1 -41.785713,0 20.892857,8.8392859 0 1 1 41.785713,0 z"
transform="matrix(0.78576781,-0.61852158,0.61852158,0.78576781,-27.227771,976.08263)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="96"
height="96"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="preview-rendered.svg">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-206.25075 : 119.68854 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="183.50001 : 140.32143 : 1"
inkscape:persp3d-origin="48 : 32 : 1"
id="perspective3792" />
<linearGradient
id="linearGradient3755">
<stop
style="stop-color:#424242;stop-opacity:1;"
offset="0"
id="stop3757" />
<stop
style="stop-color:#9f9f9f;stop-opacity:1;"
offset="1"
id="stop3759" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3755"
id="linearGradient3761"
x1="75.724594"
y1="85.023956"
x2="41.895164"
y2="13.334851"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="40.368394"
inkscape:cy="37.766162"
inkscape:document-units="px"
inkscape:current-layer="g3794"
showgrid="false"
showborder="true"
inkscape:window-width="1920"
inkscape:window-height="1053"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-956.36218)">
<g
id="g3794"
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.29399991;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate">
<path
style="fill:#b7b7b7;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 45.375,3.65625 22.419643,13.732143 20.5,21.6875 58.71875,29.34375 93.40625,8.875 z"
transform="translate(0,956.36218)"
id="path3816"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
d="m 58.731647,985.71162 0,63.26968 34.683707,-38.0674 0,-45.68166 z"
style="fill:#b7b7b7;fill-rule:evenodd;stroke:#000000;fill-opacity:1;stroke-opacity:1;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:round"
id="path3818" />
<path
d="m 22.535249,970.8073 50.212265,6.57056 -14.015867,71.60344 -52.910961,-13.4284 z"
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3820"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,56 @@
; Standard Concrete Material
; (c) 2013 Yorik van Havre (CC-BY 3.0)
; file produced by FreeCAD 0.14 2756 (Git)
; information about the content of this card can be found here:
; http://www.freecadweb.org/wiki/index.php?title=Material
[General]
Vendor=
Name=Concrete
SpecificPrice=
Father=Aggregate
ProductURL=http://en.wikipedia.org/wiki/Concrete
SpecificWeight=2400 kg/m³
Description=A standard C-25 construction concrete
[Mechanical]
UltimateTensileStrength=
CompressiveStrength=25 Mpa
YoungsModulus=
Elasticity=
FractureToughness=
[FEM]
PoissonRatio=
[Architectural]
StandardCode=Masterformat 03 33 13
EnvironmentalEfficiencyClass=
FireResistanceClass=
Finish=
Color=
ExecutionInstructions=
SoundTransmissionClass=
UnitsPerQuantity=
ThermalConductivity=
Model=
[Rendering]
TextureScaling=
FragmentShader=
AmbientColor=
EmissiveColor=
DiffuseColor=
Shininess=
SpecularColor=
Transparency=
VertexShader=
TexturePath=
[Vector rendering]
ViewLinewidth=
ViewFillPattern=
SectionLinewidth=
SectionFillPattern=
ViewColor=

View File

@ -26,6 +26,21 @@ __title__="FreeCAD material card importer"
__author__ = "Juergen Riegel"
__url__ = "http://www.freecadweb.org"
# file structure - this affects how files are saved
FileStructure = [
[ "Meta", ["CardName","AuthorAndLicense","Source"] ],
[ "General", ["Name","Father","Description","SpecificWeight","Vendor","ProductURL","SpecificPrice"] ],
[ "Mechanical", ["YoungsModulus","UltimateTensileStrength","CompressiveStrength","Elasticity","FractureToughness"] ],
[ "FEM", ["PoissonRatio"] ],
[ "Architectural", ["Model","ExecutionInstructions","FireResistanceClass","StandardCode","ThermalConductivity","SoundTransmissionClass","Color","Finish","UnitsPerQuantity","EnvironmentalEfficiencyClass"] ],
[ "Rendering", ["DiffuseColor","AmbientColor","SpecularColor","Shininess","EmissiveColor","Transparency","VertexShader","FragmentShader","TexturePath","TextureScaling"] ],
[ "Vector rendering",["ViewColor","ViewFillPattern","SectionFillPattern","ViewLinewidth","SectionLinewidth"] ],
[ "User defined", [] ]
]
# to distinguish python built-in open function from the one declared below
if open.__module__ == '__builtin__':
pythonopen = open
def open(filename):
"called when freecad wants to open a file"
@ -45,6 +60,10 @@ def insert(filename,docname):
FreeCAD.ActiveDocument = doc
read(filename)
return doc
def export(exportList,filename):
"called when freecad exports a file"
return
def decode(name):
"decodes encoded strings"
@ -59,8 +78,65 @@ def decode(name):
return decodedName
def read(filename):
FreeCAD.Console.PrintError("Not implemented yet")
def export(exportList,filename):
"called when freecad exports a file"
return
"reads a FCMat file and returns a dictionary from it"
f = pythonopen(filename)
d = {}
l = 0
for line in f:
if l == 0:
d["CardName"] = line.split(";")[1].strip()
elif l == 1:
d["AuthorAndLicense"] = line.split(";")[1].strip()
else:
if not line[0] in ";#[":
k = line.split("=")
if len(k) == 2:
d[k[0].strip()] = k[1].strip().decode('utf-8')
l += 1
return d
def write(filename,dictionary):
"writes the given dictionary to the given file"
# sort the data into sections
contents = []
for key in FileStructure:
contents.append({"keyname":key[0]})
if key[0] == "Meta":
header = contents[-1]
elif key[0] == "User defined":
user = contents[-1]
for p in key[1]:
contents[-1][p] = ""
for k,i in dictionary.iteritems():
found = False
for group in contents:
if not found:
if k in group.keys():
group[k] = i
found = True
if not found:
user[k] = i
# write header
rev = FreeCAD.ConfigGet("BuildVersionMajor")+"."+FreeCAD.ConfigGet("BuildVersionMinor")+" "+FreeCAD.ConfigGet("BuildRevision")
f = pythonopen(filename,"wb")
f.write("; " + header["CardName"] + "\n")
f.write("; " + header["AuthorAndLicense"] + "\n")
f.write("; file produced by FreeCAD " + rev + "\n")
f.write("; information about the content of this card can be found here:\n")
f.write("; http://www.freecadweb.org/wiki/index.php?title=Material\n")
f.write("\n")
if header["Source"]:
f.write("; source of the data provided in this card:\n")
f.write("; " + header["Source"] + "\n")
f.write("\n")
# write sections
for s in contents:
if s["keyname"] != "Meta":
if len(s) > 1:
# if the section has no contents, we don't write it
f.write("[" + s["keyname"] + "]\n")
for k,i in s.iteritems():
if k != "keyname":
f.write(k + "=" + i.encode('utf-8') + "\n")
f.write("\n")
f.close()

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<class>MaterialEditor</class>
<widget class="QDialog" name="MaterialEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>422</width>
<height>470</height>
<width>450</width>
<height>599</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Material Editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -19,38 +19,39 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QPushButton" name="ButtonURL">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Opens the Product URL of this material in an external browser</string>
</property>
<property name="text">
<string>Material</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QLabel" name="label">
<property name="text">
<string>Material card:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="ComboMaterial">
<property name="minimumSize">
<size>
<width>0</width>
<width>120</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>Steel</string>
</property>
<property name="icon">
<iconset theme="gnome-dev-removable"/>
</property>
</item>
<item>
<property name="text">
<string>Wood</string>
</property>
</item>
<item>
<property name="text">
<string>Brick</string>
</property>
</item>
<property name="toolTip">
<string>Existing material cards</string>
</property>
</widget>
</item>
<item>
@ -67,32 +68,100 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="ButtonOpen">
<property name="toolTip">
<string>Opens an existing material card</string>
</property>
<property name="text">
<string>Delete</string>
<string>Open...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Import...</string>
<widget class="QPushButton" name="ButtonSave">
<property name="toolTip">
<string>Saves this material as a card</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>Export...</string>
<string>Save as...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Preview</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGraphicsView" name="PreviewRendered">
<property name="minimumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QGraphicsView" name="PreviewVector">
<property name="minimumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QTreeWidget" name="treeWidget">
<widget class="QTreeWidget" name="Editor">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>300</height>
</size>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
@ -118,10 +187,66 @@
<string>Value</string>
</property>
</column>
<item>
<property name="text">
<string>Meta information</string>
</property>
<property name="toolTip">
<string>Additional information that will be written in the material card.</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item>
<property name="text">
<string>Card Name</string>
</property>
<property name="toolTip">
<string>This is a description of your material, for ex. &quot;Standard Steel Material&quot;</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Author And License</string>
</property>
<property name="toolTip">
<string>Your name and license info, for ex. &quot;John Smith, CC-BY 3.0&quot;</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Source</string>
</property>
<property name="toolTip">
<string>An optional description of where the informations included in this card come from</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
<item>
<property name="text">
<string>General</string>
</property>
<property name="toolTip">
<string>General properties of this material</string>
</property>
<property name="font">
<font>
<weight>75</weight>
@ -154,16 +279,92 @@
<property name="text">
<string>Name</string>
</property>
<property name="toolTip">
<string>A uniquely identificable name, for ex. &quot;Steel&quot;. This should match the name of the card.</string>
</property>
<property name="text">
<string>Steel</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Father</string>
</property>
<property name="toolTip">
<string>An optional father material. Missing properties here will be taken from the father. For ex. &quot;Metal&quot;</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Description</string>
</property>
<property name="toolTip">
<string>A longer and more precise description of your material</string>
</property>
<property name="text">
<string>A long description of this steel material and its milagrous properties</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Specific Weight</string>
</property>
<property name="toolTip">
<string>Specific weight of this material, in kg/mm³. For ex. 7800.0e-12</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Vendor</string>
</property>
<property name="toolTip">
<string>The name of the vendor of this material</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Product URL</string>
</property>
<property name="toolTip">
<string>A URL where information about this material can be found</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Specific Price</string>
</property>
<property name="toolTip">
<string>A price for this material, including the unit, for ex. 1.5 EUR/kg</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
@ -174,6 +375,9 @@
<property name="text">
<string>Mechanical</string>
</property>
<property name="toolTip">
<string>Mechanical properties of this material</string>
</property>
<property name="font">
<font>
<weight>75</weight>
@ -203,10 +407,91 @@
</property>
<item>
<property name="text">
<string>Young Module</string>
<string>Youngs Modulus</string>
</property>
<property name="toolTip">
<string>Also called tensile modulus or elastic modulus, a measure of the stiffness of a material, in kPa</string>
</property>
<property name="text">
<string>0.00001</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Ultimate Tensile Strength</string>
</property>
<property name="toolTip">
<string>The maximum stress that a material can withstand while being stretched or pulled before failing or breaking, in MPa</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Compressive Strength</string>
</property>
<property name="toolTip">
<string>The capacity of a material or structure to withstand loads tending to reduce size</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Elasticity</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Fracture Toughness</string>
</property>
<property name="toolTip">
<string>The ability of a material containing a crack to resist fracture</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
<item>
<property name="text">
<string>FEM</string>
</property>
<property name="toolTip">
<string>FEM-related properties</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item>
<property name="text">
<string>Poisson Ratio</string>
</property>
<property name="toolTip">
<string>The Poisson ratio is the negative ratio of transverse to axial strain.</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
@ -214,6 +499,9 @@
<property name="text">
<string>Architectural</string>
</property>
<property name="toolTip">
<string>Architectural properties</string>
</property>
<property name="font">
<font>
<weight>75</weight>
@ -243,26 +531,115 @@
</property>
<item>
<property name="text">
<string>Vendor</string>
<string>Model</string>
</property>
<property name="text">
<string>Steel Prod. Co. Inc. Ltd. Pty.</string>
<property name="toolTip">
<string>The specific model of a certain product</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Product URL</string>
<string>Execution Instructions</string>
</property>
<property name="text">
<string>http://www.steel.com/steel1234</string>
<property name="toolTip">
<string>Specific execution or installation insstructions</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Other Property</string>
<string>Fire Resistance Class</string>
</property>
<property name="toolTip">
<string>Fire resistance standard and class, for ex. RF 1h or UL 350-2</string>
</property>
<property name="text">
<string>Some absurd value</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Standard Code</string>
</property>
<property name="toolTip">
<string>The standard and code this material is described in, for ex. MasterFormat 03-1113.310</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Thermal Conductivity</string>
</property>
<property name="toolTip">
<string>The property of a material to conduct heat, in W/mK.</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Sound Transmission Class</string>
</property>
<property name="toolTip">
<string>A standard and rating indicating how well a material attenuates airborne sound. For ex. STC 44</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Color</string>
</property>
<property name="toolTip">
<string>A specific color for this product</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Finish</string>
</property>
<property name="toolTip">
<string>A special finish specification for this product</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Units Per Quantity</string>
</property>
<property name="toolTip">
<string>In case this product is made of small units, this property describes how many units fit into a certain volume or area, for ex. 50 units/m³</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Environmental Efficiency Class</string>
</property>
<property name="toolTip">
<string>A standard and rating of this material regarding sustainability and environmental design</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
@ -270,6 +647,9 @@
<property name="text">
<string>Rendering</string>
</property>
<property name="toolTip">
<string>Properties used by the FreeCAD 3D view, but also by external renderers</string>
</property>
<property name="font">
<font>
<weight>75</weight>
@ -310,24 +690,131 @@
<property name="text">
<string>Diffuse Color</string>
</property>
<property name="toolTip">
<string>A diffuse color, expressed with 3 comma-separated float values, for ex. 0.5,0.5,0.5</string>
</property>
<property name="text">
<string>rgb(255,0,0)</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Ambient Color</string>
</property>
<property name="toolTip">
<string>An ambient color, expressed with 3 comma-separated float values, for ex. 0.5,0.5,0.5</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Specular Color</string>
</property>
<property name="toolTip">
<string>A specular color, expressed with 3 comma-separated float values, for ex. 0.5,0.5,0.5</string>
</property>
<property name="text">
<string>rgb(255,255,255)</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Specular Intensity Item</string>
<string>Shininess</string>
</property>
<property name="toolTip">
<string>An intensity value for shininess/specularity, expressed as a float value between 0 and 1.0</string>
</property>
<property name="text">
<string>100</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Emissive Color</string>
</property>
<property name="toolTip">
<string>An emission color, expressed with 3 comma-separated float values, for ex. 0.5,0.5,0.5</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Transparency</string>
</property>
<property name="toolTip">
<string>A transparency value, expressed as a float value between 0 (opaque) and 1.0 (fully transparent)</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Vertex Shader</string>
</property>
<property name="toolTip">
<string>An optional vertex shader to be used by renderers that support it</string>
</property>
<property name="text">
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Fragment Shader</string>
</property>
<property name="toolTip">
<string>An optional fragment shader to be used by renderers that support it</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Texture Path</string>
</property>
<property name="toolTip">
<string>A path to a texture image, to be used by the renderers that support it</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Texture Scaling</string>
</property>
<property name="toolTip">
<string>A scaling value for the texture, might be used differently by different renderes</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
@ -335,6 +822,9 @@
<property name="text">
<string>Vector rendering</string>
</property>
<property name="toolTip">
<string>Properties applicable in vector renderings</string>
</property>
<property name="font">
<font>
<weight>75</weight>
@ -366,119 +856,127 @@
<property name="text">
<string>View Color</string>
</property>
<property name="toolTip">
<string>A base color for viewed faces, expressed with 3 comma-separated float values, for ex. 0.5,0.5,0.5</string>
</property>
<property name="text">
<string>rgb(255,0,0)</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Section Fill</string>
<string>View Fill Pattern</string>
</property>
<property name="toolTip">
<string>An SVG pattern to apply on viewed faces, expressed as either a name of an existing pattern (such as &quot;simple&quot;) or a complete &lt;pattern&gt;...&lt;/pattern&gt; SVG element</string>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Section Fill Pattern</string>
</property>
<property name="toolTip">
<string>An SVG pattern to apply on cut faces, expressed as either a name of an existing pattern (such as &quot;simple&quot;) or a complete &lt;pattern&gt;...&lt;/pattern&gt; SVG element</string>
</property>
<property name="text">
<string>slant fill</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>View Linewidth</string>
</property>
<property name="toolTip">
<string>An optional linewidth factor for viewed faces</string>
</property>
<property name="text">
<string>1px</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Section Linewidth</string>
</property>
<property name="toolTip">
<string>An optional linewidth factor for cut faces</string>
</property>
<property name="text">
<string>4px</string>
<string/>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
</property>
</item>
</item>
<item>
<property name="text">
<string>User defined</string>
</property>
<property name="toolTip">
<string>Additional properties defined by the user</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Add new property</string>
<string>Add / Remove</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Group</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<property name="text">
<string>General</string>
</property>
<widget class="QLineEdit" name="EditProperty"/>
</item>
<item>
<property name="text">
<string>Mechanical</string>
</property>
<widget class="QPushButton" name="ButtonAddProperty">
<property name="text">
<string>Add property</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Architectural</string>
</property>
<widget class="QPushButton" name="ButtonDeleteProperty">
<property name="text">
<string>Delete property</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Rendering</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Add new property...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete property</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="standardButtons">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>