Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2014-05-03 14:06:48 +02:00
commit 0eb6acdc1c
3 changed files with 45 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>531</width>
<height>548</height>
<width>553</width>
<height>612</height>
</rect>
</property>
<property name="windowTitle">
@ -358,6 +358,35 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>WebGL export</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_5">
<property name="toolTip">
<string>If this is checked, wires will be discretized, which results in more accurate curves, but heavier files.</string>
</property>
<property name="text">
<string>Discretize wires</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>webGlDiscretizeCurves</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -38,6 +38,9 @@ else:
def translate(ctxt,txt):
return txt
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
DISCRETIZE = p.GetBool("webGlDiscretizeCurves",False)
tab = " " # the tab size
wireframeStyle = "faceloop" # this can be "faceloop", "multimaterial" or None
cameraPosition = None # set this to a tuple to change, for ex. (0,0,0)
@ -172,7 +175,14 @@ def getObjectData(obj,wireframeMode=wireframeStyle):
for f in obj.Shape.Faces:
for w in f.Wires:
wo = Part.Wire(DraftGeomUtils.sortEdges(w.Edges))
wires.append(wo.discretize(0.1))
if DISCRETIZE:
wires.append(wo.discretize(0.1))
else:
p = []
for v in wo.Vertexes:
p.append(v.Point)
p.append(wo.Vertexes[0].Point)
wires.append(p)
elif obj.isDerivedFrom("Mesh::Feature"):
mesh = obj.Mesh