This commit is contained in:
wmayer 2015-12-23 15:44:38 +01:00
commit ff806af026
3 changed files with 55 additions and 22 deletions

View File

@ -384,7 +384,7 @@ class _ArchDrawingView:
import ArchVRM, WorkingPlane
wp = WorkingPlane.plane()
wp.setFromPlacement(obj.Source.Placement)
wp.inverse()
#wp.inverse()
render = ArchVRM.Renderer()
render.setWorkingPlane(wp)
render.addObjects(objs)
@ -392,12 +392,14 @@ class _ArchDrawingView:
render.cut(obj.Source.Shape,obj.ShowCut)
else:
render.cut(obj.Source.Shape)
self.svg += '<g transform="scale(1,-1)">\n'
self.svg += render.getViewSVG(linewidth="LWPlaceholder")
self.svg += fillpattern
self.svg += render.getSectionSVG(linewidth="SWPlaceholder",fillpattern="sectionfill")
if hasattr(obj,"ShowCut"):
if obj.ShowCut:
self.svg += render.getHiddenSVG(linewidth="LWPlaceholder")
self.svg += '</g>\n'
# print render.info()
else:

View File

@ -774,6 +774,7 @@ class _StructuralSystem(ArchComponent.Component):
ArchComponent.Component.__init__(self,obj)
obj.addProperty("App::PropertyLinkList","Axes","Arch",translate("Arch","Axes systems this structure is built on"))
obj.addProperty("App::PropertyIntegerList","Exclude","Arch",translate("Arch","The element numbers to exclude when this structure is based on axes"))
obj.addProperty("App::PropertyBool","Align","Arch","If true the element are aligned with axes").Align = False
self.Type = "StructuralSystem"
def execute(self,obj):
@ -794,7 +795,13 @@ class _StructuralSystem(ArchComponent.Component):
# applying axes
pts = self.getAxisPoints(obj)
apl = self.getAxisPlacement(obj)
if hasattr(obj,"Align"):
if obj.Align == False :
apl = self.getAxisPlacement(obj)
if obj.Align == True :
apl = None
else :
apl = self.getAxisPlacement(obj)
if pts:
fsh = []
@ -830,8 +837,19 @@ class _StructuralSystem(ArchComponent.Component):
import DraftGeomUtils
pts = []
if len(obj.Axes) == 1:
for e in obj.Axes[0].Shape.Edges:
pts.append(e.Vertexes[0].Point)
if hasattr(obj,"Align"):
if obj.Align == True :
p0 = obj.Axes[0].Shape.Edges[0].Vertexes[1].Point
for e in obj.Axes[0].Shape.Edges:
p = e.Vertexes[1].Point
p = p.sub(p0)
pts.append(p)
else:
for e in obj.Axes[0].Shape.Edges:
pts.append(e.Vertexes[0].Point)
else:
for e in obj.Axes[0].Shape.Edges:
pts.append(e.Vertexes[0].Point)
elif len(obj.Axes) >= 2:
set1 = obj.Axes[0].Shape.Edges
set2 = obj.Axes[1].Shape.Edges

View File

@ -2094,31 +2094,44 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
elif getType(obj) == "Axis":
"returns the SVG representation of an Arch Axis system"
vobj = obj.ViewObject
lorig = getLineStyle()
fill = 'none'
invpl = obj.Placement.inverse()
rad = vobj.BubbleSize.Value/2
n = 0
for e in obj.Shape.Edges:
lstyle = lorig
svg += getPath([e])
p1 = invpl.multVec(e.Vertexes[0].Point)
p2 = invpl.multVec(e.Vertexes[1].Point)
dv = p2.sub(p1)
dv.normalize()
rad = obj.ViewObject.BubbleSize
center = p2.add(dv.scale(rad,rad,rad))
lstyle = "none"
svg += getCircle(Part.makeCircle(rad,center))
svg += '<text fill="' + stroke + '" '
svg += 'font-size="' + str(rad) + '" '
svg += 'style="text-anchor:middle;'
svg += 'text-align:center;'
svg += 'font-family: sans;" '
svg += 'transform="translate(' + str(center.x+rad/4.0) + ',' + str(center.y-rad/3.0) + ') '
svg += 'scale(1,-1)"> '
svg += '<tspan>' + obj.ViewObject.Proxy.getNumber(n) + '</tspan>\n'
svg += '</text>\n'
n += 1
pos = ["Start"]
if hasattr(vobj,"BubblePosition"):
if vobj.BubblePosition == "Both":
pos = ["Start","End"]
else:
pos = [vobj.BubblePosition]
for p in pos:
if p == "Start":
p1 = e.Vertexes[0].Point
p2 = e.Vertexes[1].Point
else:
p1 = e.Vertexes[1].Point
p2 = e.Vertexes[0].Point
dv = p2.sub(p1)
dv.normalize()
center = p2.add(dv.scale(rad,rad,rad))
svg += getCircle(Part.makeCircle(rad,center))
if hasattr(vobj.Proxy,"bubbletexts"):
if len (vobj.Proxy.bubbletexts) >= n:
svg += '<text fill="' + stroke + '" '
svg += 'font-size="' + str(rad) + '" '
svg += 'style="text-anchor:middle;'
svg += 'text-align:center;'
svg += 'font-family: sans;" '
svg += 'transform="translate(' + str(center.x+rad/4.0) + ',' + str(center.y-rad/3.0) + ') '
svg += 'scale(1,-1)"> '
svg += '<tspan>' + obj.ViewObject.Proxy.bubbletexts[n].string.getValues()[0] + '</tspan>\n'
svg += '</text>\n'
n += 1
elif getType(obj) == "Space":
"returns an SVG fragment for the text of a space"