Arch structures can now be based on axes systems

This commit is contained in:
Yorik van Havre
2012-01-12 12:31:11 -02:00
parent a1ae6156e5
commit eed64271ae
3 changed files with 43 additions and 11 deletions

View File

@@ -84,15 +84,30 @@ class _Structure(ArchComponent.Component):
"The width of this element, if not based on a profile")
obj.addProperty("App::PropertyLength","Height","Base",
"The height or extrusion depth of this element. Keep 0 for automatic")
obj.addProperty("App::PropertyLinkList","Axes","Base",
"Axes systems this structure is built on")
self.Type = "Structure"
def execute(self,obj):
self.createGeometry(obj)
def onChanged(self,obj,prop):
if prop in ["Base","Length","Width","Height","Normal","Additions","Subtractions"]:
if prop in ["Base","Length","Width","Height","Normal","Additions","Subtractions","Axes"]:
self.createGeometry(obj)
def getAxisPoints(self,obj):
"returns the gridpoints of linked axes"
from draftlibs import fcgeo
pts = []
if len(obj.Axes) >= 2:
set1 = obj.Axes[0].Shape.Edges
set2 = obj.Axes[1].Shape.Edges
for e1 in set1:
for e2 in set2:
pts.extend(fcgeo.findIntersection(e1,e2))
return pts
return None
def createGeometry(self,obj):
import Part
from draftlibs import fcgeo
@@ -158,8 +173,17 @@ class _Structure(ArchComponent.Component):
base = base.cut(hole.Shape)
hole.ViewObject.hide() # to be removed
if base:
obj.Shape = base
if not fcgeo.isNull(pl): obj.Placement = pl
pts = self.getAxisPoints(obj)
if pts:
fsh = []
for p in pts:
sh = base.copy()
sh.translate(p)
fsh.append(sh)
obj.Shape = Part.makeCompound(fsh)
else:
obj.Shape = base
if not fcgeo.isNull(pl): obj.Placement = pl
class _ViewProviderStructure(ArchComponent.ViewProviderComponent):
"A View Provider for the Structure object"