Used new PropertyQuantity API in Draft & Arch - fixes #1414
This commit is contained in:
parent
c565cf0c78
commit
a63f4c1f2e
|
@ -117,7 +117,7 @@ class _ViewProviderAxis:
|
||||||
"A View Provider for the Axis object"
|
"A View Provider for the Axis object"
|
||||||
|
|
||||||
def __init__(self,vobj):
|
def __init__(self,vobj):
|
||||||
vobj.addProperty("App::PropertyLength","BubbleSize","Arch", translate("Arch","The size of the axis bubbles"))
|
vobj.addProperty("App::PropertyFloat","BubbleSize","Arch", translate("Arch","The size of the axis bubbles"))
|
||||||
vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", translate("Arch","The numbering style"))
|
vobj.addProperty("App::PropertyEnumeration","NumberingStyle","Arch", translate("Arch","The numbering style"))
|
||||||
vobj.addProperty("App::PropertyEnumeration","DrawStyle","Base","")
|
vobj.addProperty("App::PropertyEnumeration","DrawStyle","Base","")
|
||||||
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
|
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
|
||||||
|
|
|
@ -282,12 +282,9 @@ class ComponentTaskPanel:
|
||||||
class Component:
|
class Component:
|
||||||
"The default Arch Component object"
|
"The default Arch Component object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
obj.addProperty("App::PropertyLink","Base","Arch",
|
obj.addProperty("App::PropertyLink","Base","Arch","The base object this component is built upon")
|
||||||
"The base object this component is built upon")
|
obj.addProperty("App::PropertyLinkList","Additions","Arch","Other shapes that are appended to this object")
|
||||||
obj.addProperty("App::PropertyLinkList","Additions","Arch",
|
obj.addProperty("App::PropertyLinkList","Subtractions","Arch","Other shapes that are subtracted from this object")
|
||||||
"Other shapes that are appended to this object")
|
|
||||||
obj.addProperty("App::PropertyLinkList","Subtractions","Arch",
|
|
||||||
"Other shapes that are subtracted from this object")
|
|
||||||
obj.Proxy = self
|
obj.Proxy = self
|
||||||
self.Type = "Component"
|
self.Type = "Component"
|
||||||
self.Subvolume = None
|
self.Subvolume = None
|
||||||
|
|
|
@ -82,10 +82,8 @@ class _CommandFloor:
|
||||||
class _Floor:
|
class _Floor:
|
||||||
"The Floor object"
|
"The Floor object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
obj.addProperty("App::PropertyLength","Height","Arch",
|
obj.addProperty("App::PropertyLength","Height","Arch",translate("Arch","The height of this floor"))
|
||||||
translate("Arch","The height of this floor"))
|
obj.addProperty("App::PropertyPlacement","Placement","Arch",translate("Arch","The placement of this group"))
|
||||||
obj.addProperty("App::PropertyPlacement","Placement","Arch",
|
|
||||||
translate("Arch","The placement of this group"))
|
|
||||||
self.Type = "Floor"
|
self.Type = "Floor"
|
||||||
obj.Proxy = self
|
obj.Proxy = self
|
||||||
self.Object = obj
|
self.Object = obj
|
||||||
|
@ -112,9 +110,10 @@ class _Floor:
|
||||||
o.Placement.move(delta)
|
o.Placement.move(delta)
|
||||||
self.OldPlacement = pl
|
self.OldPlacement = pl
|
||||||
# adjust childrens heights
|
# adjust childrens heights
|
||||||
|
if obj.Height.Value:
|
||||||
for o in obj.Group:
|
for o in obj.Group:
|
||||||
if Draft.getType(o) in ["Wall","Structure"]:
|
if Draft.getType(o) in ["Wall","Structure"]:
|
||||||
if not o.Height:
|
if not o.Height.Value:
|
||||||
o.Proxy.execute(o)
|
o.Proxy.execute(o)
|
||||||
|
|
||||||
def addObject(self,child):
|
def addObject(self,child):
|
||||||
|
|
|
@ -45,6 +45,7 @@ def makeFrame(base,profile,name=translate("Arch","Frame")):
|
||||||
obj.Base = base
|
obj.Base = base
|
||||||
obj.Profile = profile
|
obj.Profile = profile
|
||||||
#profile.ViewObject.hide()
|
#profile.ViewObject.hide()
|
||||||
|
return obj
|
||||||
|
|
||||||
class _CommandFrame:
|
class _CommandFrame:
|
||||||
"the Arch Frame command definition"
|
"the Arch Frame command definition"
|
||||||
|
|
|
@ -164,7 +164,7 @@ class _Rebar(ArchComponent.Component):
|
||||||
return
|
return
|
||||||
if not obj.Base.Shape.Wires:
|
if not obj.Base.Shape.Wires:
|
||||||
return
|
return
|
||||||
if not obj.Diameter:
|
if not obj.Diameter.Value:
|
||||||
return
|
return
|
||||||
if not obj.Amount:
|
if not obj.Amount:
|
||||||
return
|
return
|
||||||
|
@ -173,7 +173,7 @@ class _Rebar(ArchComponent.Component):
|
||||||
if hasattr(obj,"Rounding"):
|
if hasattr(obj,"Rounding"):
|
||||||
print obj.Rounding
|
print obj.Rounding
|
||||||
if obj.Rounding:
|
if obj.Rounding:
|
||||||
radius = obj.Rounding * obj.Diameter
|
radius = obj.Rounding * obj.Diameter.Value
|
||||||
import DraftGeomUtils
|
import DraftGeomUtils
|
||||||
wire = DraftGeomUtils.filletWire(wire,radius)
|
wire = DraftGeomUtils.filletWire(wire,radius)
|
||||||
bpoint, bvec = self.getBaseAndAxis(obj)
|
bpoint, bvec = self.getBaseAndAxis(obj)
|
||||||
|
@ -188,13 +188,13 @@ class _Rebar(ArchComponent.Component):
|
||||||
size = axis.Length
|
size = axis.Length
|
||||||
#print axis
|
#print axis
|
||||||
#print size
|
#print size
|
||||||
if (obj.OffsetStart+obj.OffsetEnd) > size:
|
if (obj.OffsetStart.Value + obj.OffsetEnd.Value) > size:
|
||||||
return
|
return
|
||||||
|
|
||||||
# all tests ok!
|
# all tests ok!
|
||||||
pl = obj.Placement
|
pl = obj.Placement
|
||||||
import Part
|
import Part
|
||||||
circle = Part.makeCircle(obj.Diameter/2,bpoint,bvec)
|
circle = Part.makeCircle(obj.Diameter.Value/2,bpoint,bvec)
|
||||||
circle = Part.Wire(circle)
|
circle = Part.Wire(circle)
|
||||||
try:
|
try:
|
||||||
bar = wire.makePipeShell([circle],True,False,2)
|
bar = wire.makePipeShell([circle],True,False,2)
|
||||||
|
@ -210,11 +210,11 @@ class _Rebar(ArchComponent.Component):
|
||||||
if hasattr(obj,"Spacing"):
|
if hasattr(obj,"Spacing"):
|
||||||
obj.Spacing = 0
|
obj.Spacing = 0
|
||||||
else:
|
else:
|
||||||
if obj.OffsetStart:
|
if obj.OffsetStart.Value:
|
||||||
baseoffset = DraftVecUtils.scaleTo(axis,obj.OffsetStart)
|
baseoffset = DraftVecUtils.scaleTo(axis,obj.OffsetStart.Value)
|
||||||
else:
|
else:
|
||||||
baseoffset = None
|
baseoffset = None
|
||||||
interval = size - (obj.OffsetStart + obj.OffsetEnd)
|
interval = size - (obj.OffsetStart.Value + obj.OffsetEnd.Value)
|
||||||
interval = interval / (obj.Amount - 1)
|
interval = interval / (obj.Amount - 1)
|
||||||
vinterval = DraftVecUtils.scaleTo(axis,interval)
|
vinterval = DraftVecUtils.scaleTo(axis,interval)
|
||||||
for i in range(obj.Amount):
|
for i in range(obj.Amount):
|
||||||
|
|
|
@ -93,10 +93,8 @@ class _Roof(ArchComponent.Component):
|
||||||
|
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
ArchComponent.Component.__init__(self,obj)
|
ArchComponent.Component.__init__(self,obj)
|
||||||
obj.addProperty("App::PropertyAngle","Angle","Base",
|
obj.addProperty("App::PropertyAngle","Angle","Base",translate("Arch","The angle of this roof"))
|
||||||
translate("Arch","The angle of this roof"))
|
obj.addProperty("App::PropertyInteger","Face","Base",translate("Arch","The face number of the base object used to build this roof"))
|
||||||
obj.addProperty("App::PropertyInteger","Face","Base",
|
|
||||||
translate("Arch","The face number of the base object used to build this roof"))
|
|
||||||
self.Type = "Roof"
|
self.Type = "Roof"
|
||||||
|
|
||||||
def execute(self,obj):
|
def execute(self,obj):
|
||||||
|
|
|
@ -94,16 +94,14 @@ class _SectionPlane:
|
||||||
"A section plane object"
|
"A section plane object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
obj.Proxy = self
|
obj.Proxy = self
|
||||||
obj.addProperty("App::PropertyPlacement","Placement","Base",
|
obj.addProperty("App::PropertyPlacement","Placement","Base",translate("Arch","The placement of this object"))
|
||||||
translate("Arch","The placement of this object"))
|
|
||||||
obj.addProperty("Part::PropertyPartShape","Shape","Base","")
|
obj.addProperty("Part::PropertyPartShape","Shape","Base","")
|
||||||
obj.addProperty("App::PropertyLinkList","Objects","Arch",
|
obj.addProperty("App::PropertyLinkList","Objects","Arch",translate("Arch","The objects that must be considered by this section plane. Empty means all document"))
|
||||||
translate("Arch","The objects that must be considered by this section plane. Empty means all document"))
|
|
||||||
self.Type = "SectionPlane"
|
self.Type = "SectionPlane"
|
||||||
|
|
||||||
def execute(self,obj):
|
def execute(self,obj):
|
||||||
import Part
|
import Part
|
||||||
l = obj.ViewObject.DisplaySize
|
l = obj.ViewObject.DisplaySize.Value
|
||||||
p = Part.makePlane(l,l,Vector(l/2,-l/2,0),Vector(0,0,-1))
|
p = Part.makePlane(l,l,Vector(l/2,-l/2,0),Vector(0,0,-1))
|
||||||
p.Placement = obj.Placement
|
p.Placement = obj.Placement
|
||||||
obj.Shape = p
|
obj.Shape = p
|
||||||
|
@ -124,8 +122,7 @@ class _SectionPlane:
|
||||||
class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent):
|
class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent):
|
||||||
"A View Provider for Section Planes"
|
"A View Provider for Section Planes"
|
||||||
def __init__(self,vobj):
|
def __init__(self,vobj):
|
||||||
vobj.addProperty("App::PropertyLength","DisplaySize","Arch",
|
vobj.addProperty("App::PropertyLength","DisplaySize","Arch",translate("Arch","The display size of this section plane"))
|
||||||
translate("Arch","The display size of this section plane"))
|
|
||||||
vobj.addProperty("App::PropertyPercent","Transparency","Base","")
|
vobj.addProperty("App::PropertyPercent","Transparency","Base","")
|
||||||
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
|
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
|
||||||
vobj.addProperty("App::PropertyColor","LineColor","Base","")
|
vobj.addProperty("App::PropertyColor","LineColor","Base","")
|
||||||
|
@ -192,7 +189,7 @@ class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent):
|
||||||
if hasattr(vobj,"Transparency"):
|
if hasattr(vobj,"Transparency"):
|
||||||
self.mat2.transparency.setValue(vobj.Transparency/100.0)
|
self.mat2.transparency.setValue(vobj.Transparency/100.0)
|
||||||
elif prop == "DisplaySize":
|
elif prop == "DisplaySize":
|
||||||
hd = vobj.DisplaySize/2
|
hd = vobj.DisplaySize.Value/2
|
||||||
verts = []
|
verts = []
|
||||||
fverts = []
|
fverts = []
|
||||||
for v in [[-hd,-hd],[hd,-hd],[hd,hd],[-hd,hd]]:
|
for v in [[-hd,-hd],[hd,-hd],[hd,hd],[-hd,hd]]:
|
||||||
|
|
|
@ -85,14 +85,10 @@ class _Site(ArchFloor._Floor):
|
||||||
"The Site object"
|
"The Site object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
ArchFloor._Floor.__init__(self,obj)
|
ArchFloor._Floor.__init__(self,obj)
|
||||||
obj.addProperty("App::PropertyLink","Terrain","Arch",
|
obj.addProperty("App::PropertyLink","Terrain","Arch",translate("Arch","The terrain of this site"))
|
||||||
translate("Arch","The terrain of this site"))
|
obj.addProperty("App::PropertyString","Address","Arch",translate("Arch","The address of this site"))
|
||||||
obj.addProperty("App::PropertyString","Address","Arch",
|
obj.addProperty("App::PropertyString","Coordinates","Arch",translate("Arch","The geographic coordinates of this site"))
|
||||||
translate("Arch","The address of this site"))
|
obj.addProperty("App::PropertyString","Url","Arch",translate("Arch","An url that shows this site in a mapping website"))
|
||||||
obj.addProperty("App::PropertyString","Coordinates","Arch",
|
|
||||||
translate("Arch","The geographic coordinates of this site"))
|
|
||||||
obj.addProperty("App::PropertyString","Url","Arch",
|
|
||||||
translate("Arch","An url that shows this site in a mapping website"))
|
|
||||||
self.Type = "Site"
|
self.Type = "Site"
|
||||||
obj.setEditorMode('Height',2)
|
obj.setEditorMode('Height',2)
|
||||||
|
|
||||||
|
|
|
@ -100,10 +100,8 @@ class _Space(ArchComponent.Component):
|
||||||
"A space object"
|
"A space object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
obj.Proxy = self
|
obj.Proxy = self
|
||||||
obj.addProperty("App::PropertyLink","Base","Arch",
|
obj.addProperty("App::PropertyLink","Base","Arch",translate("Arch","A base shape defining this space"))
|
||||||
translate("Arch","A base shape defining this space"))
|
obj.addProperty("App::PropertyLinkSubList","Boundaries","Arch",translate("Arch","The objects that make the boundaries of this space object"))
|
||||||
obj.addProperty("App::PropertyLinkSubList","Boundaries","Arch",
|
|
||||||
translate("Arch","The objects that make the boundaries of this space object"))
|
|
||||||
self.Type = "Space"
|
self.Type = "Space"
|
||||||
|
|
||||||
def execute(self,obj):
|
def execute(self,obj):
|
||||||
|
@ -216,10 +214,8 @@ class _ViewProviderSpace(ArchComponent.ViewProviderComponent):
|
||||||
vobj.LineWidth = 1
|
vobj.LineWidth = 1
|
||||||
vobj.LineColor = (1.0,0.0,0.0,1.0)
|
vobj.LineColor = (1.0,0.0,0.0,1.0)
|
||||||
vobj.DrawStyle = "Dotted"
|
vobj.DrawStyle = "Dotted"
|
||||||
vobj.addProperty("App::PropertyString","Override","Base",
|
vobj.addProperty("App::PropertyString","Override","Base","Text override. Use $area to insert the area")
|
||||||
"Text override. Use $area to insert the area")
|
vobj.addProperty("App::PropertyColor","TextColor","Base","The color of the area text")
|
||||||
vobj.addProperty("App::PropertyColor","TextColor","Base",
|
|
||||||
"The color of the area text")
|
|
||||||
vobj.TextColor = (1.0,0.0,0.0,1.0)
|
vobj.TextColor = (1.0,0.0,0.0,1.0)
|
||||||
vobj.Override = "$area m2"
|
vobj.Override = "$area m2"
|
||||||
ArchComponent.ViewProviderComponent.__init__(self,vobj)
|
ArchComponent.ViewProviderComponent.__init__(self,vobj)
|
||||||
|
|
|
@ -48,6 +48,7 @@ def makeStairs(base=None,length=4.5,width=1,height=3,steps=17,name=translate("Ar
|
||||||
obj.Width = width
|
obj.Width = width
|
||||||
obj.Height = height
|
obj.Height = height
|
||||||
obj.NumberOfSteps = steps
|
obj.NumberOfSteps = steps
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
class _CommandStairs:
|
class _CommandStairs:
|
||||||
|
@ -78,42 +79,26 @@ class _Stairs(ArchComponent.Component):
|
||||||
# http://en.wikipedia.org/wiki/Stairs
|
# http://en.wikipedia.org/wiki/Stairs
|
||||||
|
|
||||||
# base properties
|
# base properties
|
||||||
obj.addProperty("App::PropertyLength","Length","Arch",
|
obj.addProperty("App::PropertyLength","Length","Arch",translate("Arch","The length of these stairs, if no baseline is defined"))
|
||||||
translate("Arch","The length of these stairs, if no baseline is defined"))
|
obj.addProperty("App::PropertyLength","Width","Arch",translate("Arch","The width of these stairs"))
|
||||||
obj.addProperty("App::PropertyLength","Width","Arch",
|
obj.addProperty("App::PropertyLength","Height","Arch",translate("Arch","The total height of these stairs"))
|
||||||
translate("Arch","The width of these stairs"))
|
obj.addProperty("App::PropertyEnumeration","Align","Arch",translate("Arch","The alignment of these stairs on their baseline, if applicable"))
|
||||||
obj.addProperty("App::PropertyLength","Height","Arch",
|
|
||||||
translate("Arch","The total height of these stairs"))
|
|
||||||
obj.addProperty("App::PropertyEnumeration","Align","Arch",
|
|
||||||
translate("Arch","The alignment of these stairs on their baseline, if applicable"))
|
|
||||||
|
|
||||||
# steps properties
|
# steps properties
|
||||||
obj.addProperty("App::PropertyInteger","NumberOfSteps","Steps",
|
obj.addProperty("App::PropertyInteger","NumberOfSteps","Steps",translate("Arch","The number of risers in these stairs"))
|
||||||
translate("Arch","The number of risers in these stairs"))
|
obj.addProperty("App::PropertyLength","TreadDepth","Steps",translate("Arch","The depth of the treads of these stairs"))
|
||||||
obj.addProperty("App::PropertyLength","TreadDepth","Steps",
|
obj.addProperty("App::PropertyLength","RiserHeight","Steps",translate("Arch","The height of the risers of these stairs"))
|
||||||
translate("Arch","The depth of the treads of these stairs"))
|
obj.addProperty("App::PropertyLength","Nosing","Steps",translate("Arch","The size of the nosing"))
|
||||||
obj.addProperty("App::PropertyLength","RiserHeight","Steps",
|
obj.addProperty("App::PropertyLength","TreadThickness","Steps",translate("Arch","The thickness of the treads"))
|
||||||
translate("Arch","The height of the risers of these stairs"))
|
obj.addProperty("App::PropertyLength","BlondelRatio","Steps",translate("Arch","The Blondel ratio, must be between 62 and 64cm or 24.5 and 25.5in"))
|
||||||
obj.addProperty("App::PropertyLength","Nosing","Steps",
|
|
||||||
translate("Arch","The size of the nosing"))
|
|
||||||
obj.addProperty("App::PropertyLength","TreadThickness","Steps",
|
|
||||||
translate("Arch","The thickness of the treads"))
|
|
||||||
obj.addProperty("App::PropertyLength","BlondelRatio","Steps",
|
|
||||||
translate("Arch","The Blondel ratio, must be between 62 and 64cm or 24.5 and 25.5in"))
|
|
||||||
|
|
||||||
# structural properties
|
# structural properties
|
||||||
obj.addProperty("App::PropertyEnumeration","Landings","Structure",
|
obj.addProperty("App::PropertyEnumeration","Landings","Structure",translate("Arch","The type of landings of these stairs"))
|
||||||
translate("Arch","The type of landings of these stairs"))
|
obj.addProperty("App::PropertyEnumeration","Winders","Structure",translate("Arch","The type of winders in these stairs"))
|
||||||
obj.addProperty("App::PropertyEnumeration","Winders","Structure",
|
obj.addProperty("App::PropertyEnumeration","Structure","Structure",translate("Arch","The type of structure of these stairs"))
|
||||||
translate("Arch","The type of winders in these stairs"))
|
obj.addProperty("App::PropertyLength","StructureThickness","Structure",translate("Arch","The thickness of the massive structure or of the stringers"))
|
||||||
obj.addProperty("App::PropertyEnumeration","Structure","Structure",
|
obj.addProperty("App::PropertyLength","StringerWidth","Structure",translate("Arch","The width of the stringers"))
|
||||||
translate("Arch","The type of structure of these stairs"))
|
obj.addProperty("App::PropertyLength","StructureOffset","Structure",translate("Arch","The offset between the border of the stairs and the structure"))
|
||||||
obj.addProperty("App::PropertyLength","StructureThickness","Structure",
|
|
||||||
translate("Arch","The thickness of the massive structure or of the stringers"))
|
|
||||||
obj.addProperty("App::PropertyLength","StringerWidth","Structure",
|
|
||||||
translate("Arch","The width of the stringers"))
|
|
||||||
obj.addProperty("App::PropertyLength","StructureOffset","Structure",
|
|
||||||
translate("Arch","The offset between the border of the stairs and the structure"))
|
|
||||||
|
|
||||||
obj.Align = ['Left','Right','Center']
|
obj.Align = ['Left','Right','Center']
|
||||||
obj.Landings = ["None","At center","At each corner"]
|
obj.Landings = ["None","At center","At each corner"]
|
||||||
|
@ -136,9 +121,9 @@ class _Stairs(ArchComponent.Component):
|
||||||
landings = 0
|
landings = 0
|
||||||
|
|
||||||
# base tests
|
# base tests
|
||||||
if not obj.Width:
|
if not obj.Width.Value:
|
||||||
return
|
return
|
||||||
if not obj.Height:
|
if not obj.Height.Value:
|
||||||
if not obj.Base:
|
if not obj.Base:
|
||||||
return
|
return
|
||||||
if obj.NumberOfSteps < 2:
|
if obj.NumberOfSteps < 2:
|
||||||
|
@ -171,9 +156,9 @@ class _Stairs(ArchComponent.Component):
|
||||||
else:
|
else:
|
||||||
self.makeCurvedStairs(obj,edge)
|
self.makeCurvedStairs(obj,edge)
|
||||||
else:
|
else:
|
||||||
if not obj.Length:
|
if not obj.Length.Value:
|
||||||
return
|
return
|
||||||
edge = Part.Line(Vector(0,0,0),Vector(obj.Length,0,0)).toShape()
|
edge = Part.Line(Vector(0,0,0),Vector(obj.Length.Value,0,0)).toShape()
|
||||||
if obj.Landings == "At center":
|
if obj.Landings == "At center":
|
||||||
landings = 1
|
landings = 1
|
||||||
self.makeStraightStairsWithLanding(obj,edge)
|
self.makeStraightStairsWithLanding(obj,edge)
|
||||||
|
@ -188,16 +173,16 @@ class _Stairs(ArchComponent.Component):
|
||||||
|
|
||||||
# compute step data
|
# compute step data
|
||||||
if obj.NumberOfSteps > 1:
|
if obj.NumberOfSteps > 1:
|
||||||
l = obj.Length
|
l = obj.Length.Value
|
||||||
h = obj.Height
|
h = obj.Height.Value
|
||||||
if obj.Base:
|
if obj.Base:
|
||||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||||
l = obj.Base.Shape.Length
|
l = obj.Base.Shape.Length
|
||||||
if obj.Base.Shape.BoundBox.ZLength:
|
if obj.Base.Shape.BoundBox.ZLength:
|
||||||
h = obj.Base.Shape.BoundBox.ZLength
|
h = obj.Base.Shape.BoundBox.ZLength
|
||||||
obj.TreadDepth = float(l-(landings*obj.Width))/(obj.NumberOfSteps-(1+landings))
|
obj.TreadDepth = float(l-(landings*obj.Width.Value))/(obj.NumberOfSteps-(1+landings))
|
||||||
obj.RiserHeight = float(h)/obj.NumberOfSteps
|
obj.RiserHeight = float(h)/obj.NumberOfSteps
|
||||||
obj.BlondelRatio = obj.RiserHeight*2+obj.TreadDepth
|
obj.BlondelRatio = obj.RiserHeight.Value*2+obj.TreadDepth.Value
|
||||||
|
|
||||||
|
|
||||||
def align(self,basepoint,align,widthvec):
|
def align(self,basepoint,align,widthvec):
|
||||||
|
@ -218,30 +203,30 @@ class _Stairs(ArchComponent.Component):
|
||||||
import Part,DraftGeomUtils
|
import Part,DraftGeomUtils
|
||||||
v = DraftGeomUtils.vec(edge)
|
v = DraftGeomUtils.vec(edge)
|
||||||
vLength = Vector(v.x,v.y,0)
|
vLength = Vector(v.x,v.y,0)
|
||||||
vWidth = vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width)
|
vWidth = vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width.Value)
|
||||||
vBase = edge.Vertexes[0].Point
|
vBase = edge.Vertexes[0].Point
|
||||||
vNose = DraftVecUtils.scaleTo(vLength,-abs(obj.Nosing))
|
vNose = DraftVecUtils.scaleTo(vLength,-abs(obj.Nosing.Value))
|
||||||
h = obj.Height
|
h = obj.Height.Value
|
||||||
l = obj.Length
|
l = obj.Length.Value
|
||||||
if obj.Base:
|
if obj.Base:
|
||||||
if obj.Base.isDerivedFrom("Part::Feature"):
|
if obj.Base.isDerivedFrom("Part::Feature"):
|
||||||
l = obj.Base.Shape.Length
|
l = obj.Base.Shape.Length
|
||||||
if obj.Base.Shape.BoundBox.ZLength:
|
if obj.Base.Shape.BoundBox.ZLength:
|
||||||
h = obj.Base.Shape.BoundBox.ZLength
|
h = obj.Base.Shape.BoundBox.ZLength
|
||||||
fLength = float(l-obj.Width)/(numberofsteps-2)
|
fLength = float(l-obj.Width.Value)/(numberofsteps-2)
|
||||||
fHeight = float(h)/numberofsteps
|
fHeight = float(h)/numberofsteps
|
||||||
a = math.atan(fHeight/fLength)
|
a = math.atan(fHeight/fLength)
|
||||||
print "landing data:",fLength,":",fHeight
|
print "landing data:",fLength,":",fHeight
|
||||||
|
|
||||||
# step
|
# step
|
||||||
p1 = self.align(vBase,obj.Align,vWidth)
|
p1 = self.align(vBase,obj.Align,vWidth)
|
||||||
p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness)))
|
p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness.Value)))
|
||||||
p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
|
p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
|
||||||
p3 = p2.add(vWidth)
|
p3 = p2.add(vWidth)
|
||||||
p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)
|
p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)
|
||||||
step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))
|
step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))
|
||||||
if obj.TreadThickness:
|
if obj.TreadThickness.Value:
|
||||||
step = step.extrude(Vector(0,0,abs(obj.TreadThickness)))
|
step = step.extrude(Vector(0,0,abs(obj.TreadThickness.Value)))
|
||||||
self.steps.append(step)
|
self.steps.append(step)
|
||||||
|
|
||||||
# structure
|
# structure
|
||||||
|
@ -249,61 +234,61 @@ class _Stairs(ArchComponent.Component):
|
||||||
struct = None
|
struct = None
|
||||||
p7 = None
|
p7 = None
|
||||||
p1 = p1.add(DraftVecUtils.neg(vNose))
|
p1 = p1.add(DraftVecUtils.neg(vNose))
|
||||||
p2 = p1.add(Vector(0,0,-fHeight)).add(Vector(0,0,-obj.StructureThickness/math.cos(a)))
|
p2 = p1.add(Vector(0,0,-fHeight)).add(Vector(0,0,-obj.StructureThickness.Value/math.cos(a)))
|
||||||
resheight = p1.sub(p2).Length - obj.StructureThickness
|
resheight = p1.sub(p2).Length - obj.StructureThickness.Value
|
||||||
reslength = resheight / math.tan(a)
|
reslength = resheight / math.tan(a)
|
||||||
p3 = p2.add(DraftVecUtils.scaleTo(vLength,reslength)).add(Vector(0,0,resheight))
|
p3 = p2.add(DraftVecUtils.scaleTo(vLength,reslength)).add(Vector(0,0,resheight))
|
||||||
p6 = p1.add(vLength)
|
p6 = p1.add(vLength)
|
||||||
if obj.TreadThickness:
|
if obj.TreadThickness.Value:
|
||||||
p7 = p6.add(Vector(0,0,obj.TreadThickness))
|
p7 = p6.add(Vector(0,0,obj.TreadThickness.Value))
|
||||||
|
|
||||||
reslength = fLength + (obj.StructureThickness/math.sin(a)-(fHeight-obj.TreadThickness)/math.tan(a))
|
reslength = fLength + (obj.StructureThickness.Value/math.sin(a)-(fHeight-obj.TreadThickness.Value)/math.tan(a))
|
||||||
if p7:
|
if p7:
|
||||||
p5 = p7.add(DraftVecUtils.scaleTo(vLength,reslength))
|
p5 = p7.add(DraftVecUtils.scaleTo(vLength,reslength))
|
||||||
else:
|
else:
|
||||||
p5 = p6.add(DraftVecUtils.scaleTo(vLength,reslength))
|
p5 = p6.add(DraftVecUtils.scaleTo(vLength,reslength))
|
||||||
resheight = obj.StructureThickness+obj.TreadThickness
|
resheight = obj.StructureThickness.Value + obj.TreadThickness.Value
|
||||||
reslength = resheight/math.tan(a)
|
reslength = resheight/math.tan(a)
|
||||||
p4 = p5.add(DraftVecUtils.scaleTo(vLength,-reslength)).add(Vector(0,0,-resheight))
|
p4 = p5.add(DraftVecUtils.scaleTo(vLength,-reslength)).add(Vector(0,0,-resheight))
|
||||||
if obj.Structure == "Massive":
|
if obj.Structure == "Massive":
|
||||||
if obj.StructureThickness:
|
if obj.StructureThickness.Value:
|
||||||
if p7:
|
if p7:
|
||||||
struct = Part.Face(Part.makePolygon([p1,p2,p3,p4,p5,p7,p6,p1]))
|
struct = Part.Face(Part.makePolygon([p1,p2,p3,p4,p5,p7,p6,p1]))
|
||||||
else:
|
else:
|
||||||
struct = Part.Face(Part.makePolygon([p1,p2,p3,p4,p5,p6,p1]))
|
struct = Part.Face(Part.makePolygon([p1,p2,p3,p4,p5,p6,p1]))
|
||||||
evec = vWidth
|
evec = vWidth
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
struct.translate(mvec)
|
struct.translate(mvec)
|
||||||
evec = DraftVecUtils.scaleTo(evec,evec.Length-(2*mvec.Length))
|
evec = DraftVecUtils.scaleTo(evec,evec.Length-(2*mvec.Length))
|
||||||
struct = struct.extrude(evec)
|
struct = struct.extrude(evec)
|
||||||
elif obj.Structure in ["One stringer","Two stringers"]:
|
elif obj.Structure in ["One stringer","Two stringers"]:
|
||||||
if obj.StringerWidth and obj.StructureThickness:
|
if obj.StringerWidth.Value and obj.StructureThickness.Value:
|
||||||
p1b = p1.add(Vector(0,0,-fHeight))
|
p1b = p1.add(Vector(0,0,-fHeight))
|
||||||
reslength = fHeight/math.tan(a)
|
reslength = fHeight/math.tan(a)
|
||||||
p1c = p1.add(DraftVecUtils.scaleTo(vLength,reslength))
|
p1c = p1.add(DraftVecUtils.scaleTo(vLength,reslength))
|
||||||
p5b = None
|
p5b = None
|
||||||
p5c = None
|
p5c = None
|
||||||
if obj.TreadThickness:
|
if obj.TreadThickness.Value:
|
||||||
reslength = obj.StructureThickness/math.sin(a)
|
reslength = obj.StructureThickness.Value/math.sin(a)
|
||||||
p5b = p5.add(DraftVecUtils.scaleTo(vLength,-reslength))
|
p5b = p5.add(DraftVecUtils.scaleTo(vLength,-reslength))
|
||||||
reslength = obj.TreadThickness/math.tan(a)
|
reslength = obj.TreadThickness.Value/math.tan(a)
|
||||||
p5c = p5b.add(DraftVecUtils.scaleTo(vLength,-reslength)).add(Vector(0,0,-obj.TreadThickness))
|
p5c = p5b.add(DraftVecUtils.scaleTo(vLength,-reslength)).add(Vector(0,0,-obj.TreadThickness.Value))
|
||||||
pol = Part.Face(Part.makePolygon([p1c,p1b,p2,p3,p4,p5,p5b,p5c,p1c]))
|
pol = Part.Face(Part.makePolygon([p1c,p1b,p2,p3,p4,p5,p5b,p5c,p1c]))
|
||||||
else:
|
else:
|
||||||
pol = Part.Face(Part.makePolygon([p1c,p1b,p2,p3,p4,p5,p1c]))
|
pol = Part.Face(Part.makePolygon([p1c,p1b,p2,p3,p4,p5,p1c]))
|
||||||
evec = DraftVecUtils.scaleTo(vWidth,obj.StringerWidth)
|
evec = DraftVecUtils.scaleTo(vWidth,obj.StringerWidth.Value)
|
||||||
if obj.Structure == "One stringer":
|
if obj.Structure == "One stringer":
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
else:
|
else:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,(vWidth.Length/2)-obj.StringerWidth/2)
|
mvec = DraftVecUtils.scaleTo(vWidth,(vWidth.Length/2)-obj.StringerWidth.Value/2)
|
||||||
pol.translate(mvec)
|
pol.translate(mvec)
|
||||||
struct = pol.extrude(evec)
|
struct = pol.extrude(evec)
|
||||||
elif obj.Structure == "Two stringers":
|
elif obj.Structure == "Two stringers":
|
||||||
pol2 = pol.copy()
|
pol2 = pol.copy()
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
pol.translate(mvec)
|
pol.translate(mvec)
|
||||||
mvec = vWidth.add(mvec.negative())
|
mvec = vWidth.add(mvec.negative())
|
||||||
pol2.translate(mvec)
|
pol2.translate(mvec)
|
||||||
|
@ -330,11 +315,11 @@ class _Stairs(ArchComponent.Component):
|
||||||
if round(v.z,Draft.precision()) != 0:
|
if round(v.z,Draft.precision()) != 0:
|
||||||
h = v.z
|
h = v.z
|
||||||
else:
|
else:
|
||||||
h = obj.Height
|
h = obj.Height.Value
|
||||||
vHeight = Vector(0,0,float(h)/numberofsteps)
|
vHeight = Vector(0,0,float(h)/numberofsteps)
|
||||||
vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width)
|
vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width.Value)
|
||||||
vBase = edge.Vertexes[0].Point
|
vBase = edge.Vertexes[0].Point
|
||||||
vNose = DraftVecUtils.scaleTo(vLength,-abs(obj.Nosing))
|
vNose = DraftVecUtils.scaleTo(vLength,-abs(obj.Nosing.Value))
|
||||||
a = math.atan(vHeight.Length/vLength.Length)
|
a = math.atan(vHeight.Length/vLength.Length)
|
||||||
print "stair data:",vLength.Length,":",vHeight.Length
|
print "stair data:",vLength.Length,":",vHeight.Length
|
||||||
|
|
||||||
|
@ -342,31 +327,31 @@ class _Stairs(ArchComponent.Component):
|
||||||
for i in range(numberofsteps-1):
|
for i in range(numberofsteps-1):
|
||||||
p1 = vBase.add((Vector(vLength).multiply(i)).add(Vector(vHeight).multiply(i+1)))
|
p1 = vBase.add((Vector(vLength).multiply(i)).add(Vector(vHeight).multiply(i+1)))
|
||||||
p1 = self.align(p1,obj.Align,vWidth)
|
p1 = self.align(p1,obj.Align,vWidth)
|
||||||
p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness)))
|
p1 = p1.add(vNose).add(Vector(0,0,-abs(obj.TreadThickness.Value)))
|
||||||
p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
|
p2 = p1.add(DraftVecUtils.neg(vNose)).add(vLength)
|
||||||
p3 = p2.add(vWidth)
|
p3 = p2.add(vWidth)
|
||||||
p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)
|
p4 = p3.add(DraftVecUtils.neg(vLength)).add(vNose)
|
||||||
step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))
|
step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1]))
|
||||||
if obj.TreadThickness:
|
if obj.TreadThickness.Value:
|
||||||
step = step.extrude(Vector(0,0,abs(obj.TreadThickness)))
|
step = step.extrude(Vector(0,0,abs(obj.TreadThickness.Value)))
|
||||||
self.steps.append(step)
|
self.steps.append(step)
|
||||||
|
|
||||||
# structure
|
# structure
|
||||||
lProfile = []
|
lProfile = []
|
||||||
struct = None
|
struct = None
|
||||||
if obj.Structure == "Massive":
|
if obj.Structure == "Massive":
|
||||||
if obj.StructureThickness:
|
if obj.StructureThickness.Value:
|
||||||
for i in range(numberofsteps-1):
|
for i in range(numberofsteps-1):
|
||||||
if not lProfile:
|
if not lProfile:
|
||||||
lProfile.append(vBase)
|
lProfile.append(vBase)
|
||||||
last = lProfile[-1]
|
last = lProfile[-1]
|
||||||
if len(lProfile) == 1:
|
if len(lProfile) == 1:
|
||||||
last = last.add(Vector(0,0,-abs(obj.TreadThickness)))
|
last = last.add(Vector(0,0,-abs(obj.TreadThickness.Value)))
|
||||||
lProfile.append(last.add(vHeight))
|
lProfile.append(last.add(vHeight))
|
||||||
lProfile.append(lProfile[-1].add(vLength))
|
lProfile.append(lProfile[-1].add(vLength))
|
||||||
resHeight1 = obj.StructureThickness/math.cos(a)
|
resHeight1 = obj.StructureThickness.Value/math.cos(a)
|
||||||
lProfile.append(lProfile[-1].add(Vector(0,0,-resHeight1)))
|
lProfile.append(lProfile[-1].add(Vector(0,0,-resHeight1)))
|
||||||
resHeight2 = ((numberofsteps-1)*vHeight.Length)-(resHeight1+obj.TreadThickness)
|
resHeight2 = ((numberofsteps-1)*vHeight.Length)-(resHeight1+obj.TreadThickness.Value)
|
||||||
resLength = (vLength.Length/vHeight.Length)*resHeight2
|
resLength = (vLength.Length/vHeight.Length)*resHeight2
|
||||||
h = DraftVecUtils.scaleTo(vLength,-resLength)
|
h = DraftVecUtils.scaleTo(vLength,-resLength)
|
||||||
lProfile.append(lProfile[-1].add(Vector(h.x,h.y,-resHeight2)))
|
lProfile.append(lProfile[-1].add(Vector(h.x,h.y,-resHeight2)))
|
||||||
|
@ -375,44 +360,44 @@ class _Stairs(ArchComponent.Component):
|
||||||
pol = Part.makePolygon(lProfile)
|
pol = Part.makePolygon(lProfile)
|
||||||
struct = Part.Face(pol)
|
struct = Part.Face(pol)
|
||||||
evec = vWidth
|
evec = vWidth
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
struct.translate(mvec)
|
struct.translate(mvec)
|
||||||
evec = DraftVecUtils.scaleTo(evec,evec.Length-(2*mvec.Length))
|
evec = DraftVecUtils.scaleTo(evec,evec.Length-(2*mvec.Length))
|
||||||
struct = struct.extrude(evec)
|
struct = struct.extrude(evec)
|
||||||
elif obj.Structure in ["One stringer","Two stringers"]:
|
elif obj.Structure in ["One stringer","Two stringers"]:
|
||||||
if obj.StringerWidth and obj.StructureThickness:
|
if obj.StringerWidth.Value and obj.StructureThickness.Value:
|
||||||
hyp = math.sqrt(vHeight.Length**2 + vLength.Length**2)
|
hyp = math.sqrt(vHeight.Length**2 + vLength.Length**2)
|
||||||
l1 = Vector(vLength).multiply(numberofsteps-1)
|
l1 = Vector(vLength).multiply(numberofsteps-1)
|
||||||
h1 = Vector(vHeight).multiply(numberofsteps-1).add(Vector(0,0,-abs(obj.TreadThickness)))
|
h1 = Vector(vHeight).multiply(numberofsteps-1).add(Vector(0,0,-abs(obj.TreadThickness.Value)))
|
||||||
p1 = vBase.add(l1).add(h1)
|
p1 = vBase.add(l1).add(h1)
|
||||||
p1 = self.align(p1,obj.Align,vWidth)
|
p1 = self.align(p1,obj.Align,vWidth)
|
||||||
lProfile.append(p1)
|
lProfile.append(p1)
|
||||||
h2 = (obj.StructureThickness/vLength.Length)*hyp
|
h2 = (obj.StructureThickness.Value/vLength.Length)*hyp
|
||||||
lProfile.append(lProfile[-1].add(Vector(0,0,-abs(h2))))
|
lProfile.append(lProfile[-1].add(Vector(0,0,-abs(h2))))
|
||||||
h3 = lProfile[-1].z-vBase.z
|
h3 = lProfile[-1].z-vBase.z
|
||||||
l3 = (h3/vHeight.Length)*vLength.Length
|
l3 = (h3/vHeight.Length)*vLength.Length
|
||||||
v3 = DraftVecUtils.scaleTo(vLength,-l3)
|
v3 = DraftVecUtils.scaleTo(vLength,-l3)
|
||||||
lProfile.append(lProfile[-1].add(Vector(0,0,-abs(h3))).add(v3))
|
lProfile.append(lProfile[-1].add(Vector(0,0,-abs(h3))).add(v3))
|
||||||
l4 = (obj.StructureThickness/vHeight.Length)*hyp
|
l4 = (obj.StructureThickness.Value/vHeight.Length)*hyp
|
||||||
v4 = DraftVecUtils.scaleTo(vLength,-l4)
|
v4 = DraftVecUtils.scaleTo(vLength,-l4)
|
||||||
lProfile.append(lProfile[-1].add(v4))
|
lProfile.append(lProfile[-1].add(v4))
|
||||||
lProfile.append(lProfile[0])
|
lProfile.append(lProfile[0])
|
||||||
#print lProfile
|
#print lProfile
|
||||||
pol = Part.makePolygon(lProfile)
|
pol = Part.makePolygon(lProfile)
|
||||||
pol = Part.Face(pol)
|
pol = Part.Face(pol)
|
||||||
evec = DraftVecUtils.scaleTo(vWidth,obj.StringerWidth)
|
evec = DraftVecUtils.scaleTo(vWidth,obj.StringerWidth.Value)
|
||||||
if obj.Structure == "One stringer":
|
if obj.Structure == "One stringer":
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
else:
|
else:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,(vWidth.Length/2)-obj.StringerWidth/2)
|
mvec = DraftVecUtils.scaleTo(vWidth,(vWidth.Length/2)-obj.StringerWidth.Value/2)
|
||||||
pol.translate(mvec)
|
pol.translate(mvec)
|
||||||
struct = pol.extrude(evec)
|
struct = pol.extrude(evec)
|
||||||
elif obj.Structure == "Two stringers":
|
elif obj.Structure == "Two stringers":
|
||||||
pol2 = pol.copy()
|
pol2 = pol.copy()
|
||||||
if obj.StructureOffset:
|
if obj.StructureOffset.Value:
|
||||||
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset)
|
mvec = DraftVecUtils.scaleTo(vWidth,obj.StructureOffset.Value)
|
||||||
pol.translate(mvec)
|
pol.translate(mvec)
|
||||||
mvec = vWidth.add(mvec.negative())
|
mvec = vWidth.add(mvec.negative())
|
||||||
pol2.translate(mvec)
|
pol2.translate(mvec)
|
||||||
|
@ -433,19 +418,19 @@ class _Stairs(ArchComponent.Component):
|
||||||
return
|
return
|
||||||
import Part,DraftGeomUtils
|
import Part,DraftGeomUtils
|
||||||
v = DraftGeomUtils.vec(edge)
|
v = DraftGeomUtils.vec(edge)
|
||||||
reslength = edge.Length - obj.Width
|
reslength = edge.Length - obj.Width.Value
|
||||||
vLength = DraftVecUtils.scaleTo(v,float(reslength)/(obj.NumberOfSteps-2))
|
vLength = DraftVecUtils.scaleTo(v,float(reslength)/(obj.NumberOfSteps-2))
|
||||||
vLength = Vector(vLength.x,vLength.y,0)
|
vLength = Vector(vLength.x,vLength.y,0)
|
||||||
vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width)
|
vWidth = DraftVecUtils.scaleTo(vLength.cross(Vector(0,0,1)),obj.Width.Value)
|
||||||
p1 = edge.Vertexes[0].Point
|
p1 = edge.Vertexes[0].Point
|
||||||
if round(v.z,Draft.precision()) != 0:
|
if round(v.z,Draft.precision()) != 0:
|
||||||
h = v.z
|
h = v.z
|
||||||
else:
|
else:
|
||||||
h = obj.Height
|
h = obj.Height.Value
|
||||||
hstep = h/obj.NumberOfSteps
|
hstep = h/obj.NumberOfSteps
|
||||||
landing = obj.NumberOfSteps/2
|
landing = obj.NumberOfSteps/2
|
||||||
p2 = p1.add(DraftVecUtils.scale(vLength,landing-1).add(Vector(0,0,landing*hstep)))
|
p2 = p1.add(DraftVecUtils.scale(vLength,landing-1).add(Vector(0,0,landing*hstep)))
|
||||||
p3 = p2.add(DraftVecUtils.scaleTo(vLength,obj.Width))
|
p3 = p2.add(DraftVecUtils.scaleTo(vLength,obj.Width.Value))
|
||||||
p4 = p3.add(DraftVecUtils.scale(vLength,obj.NumberOfSteps-(landing+1)).add(Vector(0,0,(obj.NumberOfSteps-landing)*hstep)))
|
p4 = p3.add(DraftVecUtils.scale(vLength,obj.NumberOfSteps-(landing+1)).add(Vector(0,0,(obj.NumberOfSteps-landing)*hstep)))
|
||||||
self.makeStraightStairs(obj,Part.Line(p1,p2).toShape(),landing)
|
self.makeStraightStairs(obj,Part.Line(p1,p2).toShape(),landing)
|
||||||
self.makeStraightLanding(obj,Part.Line(p2,p3).toShape())
|
self.makeStraightLanding(obj,Part.Line(p2,p3).toShape())
|
||||||
|
|
|
@ -520,26 +520,16 @@ class _Structure(ArchComponent.Component):
|
||||||
"The Structure object"
|
"The Structure object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
ArchComponent.Component.__init__(self,obj)
|
ArchComponent.Component.__init__(self,obj)
|
||||||
obj.addProperty("App::PropertyLink","Tool","Arch",
|
obj.addProperty("App::PropertyLink","Tool","Arch",translate("Arch","An optional extrusion path for this element"))
|
||||||
translate("Arch","An optional extrusion path for this element"))
|
obj.addProperty("App::PropertyLength","Length","Arch",translate("Arch","The length of this element, if not based on a profile"))
|
||||||
obj.addProperty("App::PropertyLength","Length","Arch",
|
obj.addProperty("App::PropertyLength","Width","Arch",translate("Arch","The width of this element, if not based on a profile"))
|
||||||
translate("Arch","The length of this element, if not based on a profile"))
|
obj.addProperty("App::PropertyLength","Height","Arch",translate("Arch","The height or extrusion depth of this element. Keep 0 for automatic"))
|
||||||
obj.addProperty("App::PropertyLength","Width","Arch",
|
obj.addProperty("App::PropertyLinkList","Axes","Arch",translate("Arch","Axes systems this structure is built on"))
|
||||||
translate("Arch","The width of this element, if not based on a profile"))
|
obj.addProperty("App::PropertyLinkList","Armatures","Arch",translate("Arch","Armatures contained in this element"))
|
||||||
obj.addProperty("App::PropertyLength","Height","Arch",
|
obj.addProperty("App::PropertyVector","Normal","Arch",translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))
|
||||||
translate("Arch","The height or extrusion depth of this element. Keep 0 for automatic"))
|
obj.addProperty("App::PropertyIntegerList","Exclude","Arch",translate("Arch","The element numbers to exclude when this structure is based on axes"))
|
||||||
obj.addProperty("App::PropertyLinkList","Axes","Arch",
|
obj.addProperty("App::PropertyEnumeration","Role","Arch",translate("Arch","The role of this structural element"))
|
||||||
translate("Arch","Axes systems this structure is built on"))
|
obj.addProperty("App::PropertyVectorList","Nodes","Arch",translate("Arch","The structural nodes of this element"))
|
||||||
obj.addProperty("App::PropertyLinkList","Armatures","Arch",
|
|
||||||
translate("Arch","Armatures contained in this element"))
|
|
||||||
obj.addProperty("App::PropertyVector","Normal","Arch",
|
|
||||||
translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))
|
|
||||||
obj.addProperty("App::PropertyIntegerList","Exclude","Arch",
|
|
||||||
translate("Arch","The element numbers to exclude when this structure is based on axes"))
|
|
||||||
obj.addProperty("App::PropertyEnumeration","Role","Arch",
|
|
||||||
translate("Arch","The role of this structural element"))
|
|
||||||
obj.addProperty("App::PropertyVectorList","Nodes","Arch",
|
|
||||||
translate("Arch","The structural nodes of this element"))
|
|
||||||
self.Type = "Structure"
|
self.Type = "Structure"
|
||||||
obj.Length = 1
|
obj.Length = 1
|
||||||
obj.Width = 1
|
obj.Width = 1
|
||||||
|
@ -556,19 +546,19 @@ class _Structure(ArchComponent.Component):
|
||||||
width = 1
|
width = 1
|
||||||
height = 1
|
height = 1
|
||||||
if hasattr(obj,"Length"):
|
if hasattr(obj,"Length"):
|
||||||
if obj.Length:
|
if obj.Length.Value:
|
||||||
length = obj.Length
|
length = obj.Length.Value
|
||||||
if hasattr(obj,"Width"):
|
if hasattr(obj,"Width"):
|
||||||
if obj.Width:
|
if obj.Width.Value:
|
||||||
width = obj.Width
|
width = obj.Width.Value
|
||||||
if hasattr(obj,"Height"):
|
if hasattr(obj,"Height"):
|
||||||
if obj.Height:
|
if obj.Height.Value:
|
||||||
height = obj.Height
|
height = obj.Height.Value
|
||||||
else:
|
else:
|
||||||
for p in obj.InList:
|
for p in obj.InList:
|
||||||
if Draft.getType(p) == "Floor":
|
if Draft.getType(p) == "Floor":
|
||||||
if p.Height:
|
if p.Height.Value:
|
||||||
height = p.Height
|
height = p.Height.Value
|
||||||
|
|
||||||
# creating base shape
|
# creating base shape
|
||||||
pl = obj.Placement
|
pl = obj.Placement
|
||||||
|
@ -789,35 +779,31 @@ class _Profile(Draft._DraftObject):
|
||||||
"A parametric beam profile object"
|
"A parametric beam profile object"
|
||||||
|
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
obj.addProperty("App::PropertyDistance","Width","Draft","Width of the beam").Width = 10
|
obj.addProperty("App::PropertyLength","Width","Draft","Width of the beam").Width = 10
|
||||||
obj.addProperty("App::PropertyDistance","Height","Draft","Height of the beam").Height = 30
|
obj.addProperty("App::PropertyLength","Height","Draft","Height of the beam").Height = 30
|
||||||
obj.addProperty("App::PropertyDistance","WebThickness","Draft","Thickness of the webs").WebThickness = 3
|
obj.addProperty("App::PropertyLength","WebThickness","Draft","Thickness of the webs").WebThickness = 3
|
||||||
obj.addProperty("App::PropertyDistance","FlangeThickness","Draft","Thickness of the flange").FlangeThickness = 2
|
obj.addProperty("App::PropertyLength","FlangeThickness","Draft","Thickness of the flange").FlangeThickness = 2
|
||||||
Draft._DraftObject.__init__(self,obj,"Profile")
|
Draft._DraftObject.__init__(self,obj,"Profile")
|
||||||
|
|
||||||
def execute(self,obj):
|
def execute(self,obj):
|
||||||
import Part
|
import Part
|
||||||
pl = obj.Placement
|
pl = obj.Placement
|
||||||
p1 = Vector(-obj.Width/2,-obj.Height/2,0)
|
p1 = Vector(-obj.Width.Value/2,-obj.Height.Value/2,0)
|
||||||
p2 = Vector(obj.Width/2,-obj.Height/2,0)
|
p2 = Vector(obj.Width.Value/2,-obj.Height.Value/2,0)
|
||||||
p3 = Vector(obj.Width/2,(-obj.Height/2)+obj.FlangeThickness,0)
|
p3 = Vector(obj.Width.Value/2,(-obj.Height.Value/2)+obj.FlangeThickness.Value,0)
|
||||||
p4 = Vector(obj.WebThickness/2,(-obj.Height/2)+obj.FlangeThickness,0)
|
p4 = Vector(obj.WebThickness.Value/2,(-obj.Height.Value/2)+obj.FlangeThickness.Value,0)
|
||||||
p5 = Vector(obj.WebThickness/2,obj.Height/2-obj.FlangeThickness,0)
|
p5 = Vector(obj.WebThickness.Value/2,obj.Height.Value/2-obj.FlangeThickness.Value,0)
|
||||||
p6 = Vector(obj.Width/2,obj.Height/2-obj.FlangeThickness,0)
|
p6 = Vector(obj.Width.Value/2,obj.Height.Value/2-obj.FlangeThickness.Value,0)
|
||||||
p7 = Vector(obj.Width/2,obj.Height/2,0)
|
p7 = Vector(obj.Width.Value/2,obj.Height.Value/2,0)
|
||||||
p8 = Vector(-obj.Width/2,obj.Height/2,0)
|
p8 = Vector(-obj.Width.Value/2,obj.Height.Value/2,0)
|
||||||
p9 = Vector(-obj.Width/2,obj.Height/2-obj.FlangeThickness,0)
|
p9 = Vector(-obj.Width.Value/2,obj.Height.Value/2-obj.FlangeThickness.Value,0)
|
||||||
p10 = Vector(-obj.WebThickness/2,obj.Height/2-obj.FlangeThickness,0)
|
p10 = Vector(-obj.WebThickness.Value/2,obj.Height.Value/2-obj.FlangeThickness.Value,0)
|
||||||
p11 = Vector(-obj.WebThickness/2,(-obj.Height/2)+obj.FlangeThickness,0)
|
p11 = Vector(-obj.WebThickness.Value/2,(-obj.Height.Value/2)+obj.FlangeThickness.Value,0)
|
||||||
p12 = Vector(-obj.Width/2,(-obj.Height/2)+obj.FlangeThickness,0)
|
p12 = Vector(-obj.Width.Value/2,(-obj.Height.Value/2)+obj.FlangeThickness.Value,0)
|
||||||
p = Part.makePolygon([p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p1])
|
p = Part.makePolygon([p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p1])
|
||||||
p = Part.Face(p)
|
p = Part.Face(p)
|
||||||
obj.Shape = p
|
obj.Shape = p
|
||||||
obj.Placement = pl
|
obj.Placement = pl
|
||||||
|
|
||||||
def onChanged(self,obj,prop):
|
|
||||||
if prop in ["Width","Height","WebThickness","FlangeThickness"]:
|
|
||||||
self.execute(obj)
|
|
||||||
|
|
||||||
if FreeCAD.GuiUp:
|
if FreeCAD.GuiUp:
|
||||||
FreeCADGui.addCommand('Arch_Structure',_CommandStructure())
|
FreeCADGui.addCommand('Arch_Structure',_CommandStructure())
|
||||||
|
|
|
@ -377,22 +377,14 @@ class _Wall(ArchComponent.Component):
|
||||||
"The Wall object"
|
"The Wall object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
ArchComponent.Component.__init__(self,obj)
|
ArchComponent.Component.__init__(self,obj)
|
||||||
obj.addProperty("App::PropertyLength","Length","Arch",
|
obj.addProperty("App::PropertyLength","Length","Arch",translate("Arch","The length of this wall. Not used if this wall is based on an underlying object"))
|
||||||
str(translate("Arch","The length of this wall. Not used if this wall is based on an underlying object")))
|
obj.addProperty("App::PropertyLength","Width","Arch",translate("Arch","The width of this wall. Not used if this wall is based on a face"))
|
||||||
obj.addProperty("App::PropertyLength","Width","Arch",
|
obj.addProperty("App::PropertyLength","Height","Arch",translate("Arch","The height of this wall. Keep 0 for automatic. Not used if this wall is based on a solid"))
|
||||||
str(translate("Arch","The width of this wall. Not used if this wall is based on a face")))
|
obj.addProperty("App::PropertyEnumeration","Align","Arch",translate("Arch","The alignment of this wall on its base object, if applicable"))
|
||||||
obj.addProperty("App::PropertyLength","Height","Arch",
|
obj.addProperty("App::PropertyVector","Normal","Arch",translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))
|
||||||
str(translate("Arch","The height of this wall. Keep 0 for automatic. Not used if this wall is based on a solid")))
|
obj.addProperty("App::PropertyBool","ForceWire","Arch",translate("Arch","If True, if this wall is based on a face, it will use its border wire as trace, and disconsider the face."))
|
||||||
obj.addProperty("App::PropertyEnumeration","Align","Arch",
|
obj.addProperty("App::PropertyInteger","Face","Arch",translate("Arch","The face number of the base object used to build this wall"))
|
||||||
str(translate("Arch","The alignment of this wall on its base object, if applicable")))
|
obj.addProperty("App::PropertyLength","Offset","Arch",translate("Arch","The offset between this wall and its baseline (only for left and right alignments)"))
|
||||||
obj.addProperty("App::PropertyVector","Normal","Arch",
|
|
||||||
str(translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")))
|
|
||||||
obj.addProperty("App::PropertyBool","ForceWire","Arch",
|
|
||||||
str(translate("Arch","If True, if this wall is based on a face, it will use its border wire as trace, and disconsider the face.")))
|
|
||||||
obj.addProperty("App::PropertyInteger","Face","Arch",
|
|
||||||
str(translate("Arch","The face number of the base object used to build this wall")))
|
|
||||||
obj.addProperty("App::PropertyLength","Offset","Arch",
|
|
||||||
str(translate("Arch","The offset between this wall and its baseline (only for left and right alignments)")))
|
|
||||||
obj.Align = ['Left','Right','Center']
|
obj.Align = ['Left','Right','Center']
|
||||||
obj.ForceWire = False
|
obj.ForceWire = False
|
||||||
self.Type = "Wall"
|
self.Type = "Wall"
|
||||||
|
@ -511,21 +503,21 @@ class _Wall(ArchComponent.Component):
|
||||||
"returns normal,width,height values from this wall"
|
"returns normal,width,height values from this wall"
|
||||||
length = 1
|
length = 1
|
||||||
if hasattr(obj,"Length"):
|
if hasattr(obj,"Length"):
|
||||||
if obj.Length:
|
if obj.Length.Value:
|
||||||
length = obj.Length
|
length = obj.Length.Value
|
||||||
width = 1
|
width = 1
|
||||||
if hasattr(obj,"Width"):
|
if hasattr(obj,"Width"):
|
||||||
if obj.Width:
|
if obj.Width.Value:
|
||||||
width = obj.Width
|
width = obj.Width.Value
|
||||||
height = 1
|
height = 1
|
||||||
if hasattr(obj,"Height"):
|
if hasattr(obj,"Height"):
|
||||||
if obj.Height:
|
if obj.Height.Value:
|
||||||
height = obj.Height
|
height = obj.Height.Value
|
||||||
else:
|
else:
|
||||||
for p in obj.InList:
|
for p in obj.InList:
|
||||||
if Draft.getType(p) == "Floor":
|
if Draft.getType(p) == "Floor":
|
||||||
if p.Height:
|
if p.Height.Value:
|
||||||
height = p.Height
|
height = p.Height.Value
|
||||||
normal = None
|
normal = None
|
||||||
if hasattr(obj,"Normal"):
|
if hasattr(obj,"Normal"):
|
||||||
if obj.Normal == Vector(0,0,0):
|
if obj.Normal == Vector(0,0,0):
|
||||||
|
@ -548,8 +540,8 @@ class _Wall(ArchComponent.Component):
|
||||||
if obj.Align == "Left":
|
if obj.Align == "Left":
|
||||||
dvec.multiply(width)
|
dvec.multiply(width)
|
||||||
if hasattr(obj,"Offset"):
|
if hasattr(obj,"Offset"):
|
||||||
if obj.Offset:
|
if obj.Offset.Value:
|
||||||
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset)
|
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset.Value)
|
||||||
wire = DraftGeomUtils.offsetWire(wire,dvec2)
|
wire = DraftGeomUtils.offsetWire(wire,dvec2)
|
||||||
w2 = DraftGeomUtils.offsetWire(wire,dvec)
|
w2 = DraftGeomUtils.offsetWire(wire,dvec)
|
||||||
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
|
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
|
||||||
|
@ -558,8 +550,8 @@ class _Wall(ArchComponent.Component):
|
||||||
dvec.multiply(width)
|
dvec.multiply(width)
|
||||||
dvec = dvec.negative()
|
dvec = dvec.negative()
|
||||||
if hasattr(obj,"Offset"):
|
if hasattr(obj,"Offset"):
|
||||||
if obj.Offset:
|
if obj.Offset.Value:
|
||||||
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset)
|
dvec2 = DraftVecUtils.scaleTo(dvec,obj.Offset.Value)
|
||||||
wire = DraftGeomUtils.offsetWire(wire,dvec2)
|
wire = DraftGeomUtils.offsetWire(wire,dvec2)
|
||||||
w2 = DraftGeomUtils.offsetWire(wire,dvec)
|
w2 = DraftGeomUtils.offsetWire(wire,dvec)
|
||||||
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
|
w1 = Part.Wire(DraftGeomUtils.sortEdges(wire.Edges))
|
||||||
|
|
|
@ -574,21 +574,14 @@ class _Window(ArchComponent.Component):
|
||||||
"The Window object"
|
"The Window object"
|
||||||
def __init__(self,obj):
|
def __init__(self,obj):
|
||||||
ArchComponent.Component.__init__(self,obj)
|
ArchComponent.Component.__init__(self,obj)
|
||||||
obj.addProperty("App::PropertyStringList","WindowParts","Arch",
|
obj.addProperty("App::PropertyStringList","WindowParts","Arch",translate("Arch","the components of this window"))
|
||||||
translate("Arch","the components of this window"))
|
obj.addProperty("App::PropertyLength","HoleDepth","Arch",translate("Arch","The depth of the hole that this window makes in its host object. Keep 0 for automatic."))
|
||||||
obj.addProperty("App::PropertyLength","HoleDepth","Arch",
|
obj.addProperty("Part::PropertyPartShape","Subvolume","Arch",translate("Arch","an optional volume to be subtracted from hosts of this window"))
|
||||||
translate("Arch","The depth of the hole that this window makes in its host object. Keep 0 for automatic."))
|
obj.addProperty("App::PropertyLength","Width","Arch",translate("Arch","The width of this window (for preset windows only)"))
|
||||||
obj.addProperty("Part::PropertyPartShape","Subvolume","Arch",
|
obj.addProperty("App::PropertyLength","Height","Arch",translate("Arch","The height of this window (for preset windows only)"))
|
||||||
translate("Arch","an optional volume to be subtracted from hosts of this window"))
|
obj.addProperty("App::PropertyVector","Normal","Arch",translate("Arch","The normal direction of this window"))
|
||||||
obj.addProperty("App::PropertyLength","Width","Arch",
|
|
||||||
translate("Arch","The width of this window (for preset windows only)"))
|
|
||||||
obj.addProperty("App::PropertyLength","Height","Arch",
|
|
||||||
translate("Arch","The height of this window (for preset windows only)"))
|
|
||||||
obj.addProperty("App::PropertyVector","Normal","Arch",
|
|
||||||
translate("Arch","The normal direction of this window"))
|
|
||||||
obj.addProperty("App::PropertyInteger","Preset","Arch","")
|
obj.addProperty("App::PropertyInteger","Preset","Arch","")
|
||||||
obj.addProperty("App::PropertyEnumeration","Role","Arch",
|
obj.addProperty("App::PropertyEnumeration","Role","Arch",translate("Arch","The role of this window"))
|
||||||
translate("Arch","The role of this window"))
|
|
||||||
obj.setEditorMode("Preset",2)
|
obj.setEditorMode("Preset",2)
|
||||||
|
|
||||||
self.Type = "Window"
|
self.Type = "Window"
|
||||||
|
@ -608,9 +601,9 @@ class _Window(ArchComponent.Component):
|
||||||
if obj.Base:
|
if obj.Base:
|
||||||
try:
|
try:
|
||||||
if prop == "Height":
|
if prop == "Height":
|
||||||
obj.Base.setDatum(16,obj.Height)
|
obj.Base.setDatum(16,obj.Height.Value)
|
||||||
elif prop == "Width":
|
elif prop == "Width":
|
||||||
obj.Base.setDatum(17,obj.Width)
|
obj.Base.setDatum(17,obj.Width.Value)
|
||||||
except:
|
except:
|
||||||
# restoring constraints when loading a file fails
|
# restoring constraints when loading a file fails
|
||||||
# because of load order, but it doesn't harm...
|
# because of load order, but it doesn't harm...
|
||||||
|
@ -691,8 +684,8 @@ class _Window(ArchComponent.Component):
|
||||||
base = obj.Base
|
base = obj.Base
|
||||||
width = 0
|
width = 0
|
||||||
if hasattr(obj,"HoleDepth"):
|
if hasattr(obj,"HoleDepth"):
|
||||||
if obj.HoleDepth:
|
if obj.HoleDepth.Value:
|
||||||
width = obj.HoleDepth
|
width = obj.HoleDepth.Value
|
||||||
if not width:
|
if not width:
|
||||||
if base:
|
if base:
|
||||||
b = base.Shape.BoundBox
|
b = base.Shape.BoundBox
|
||||||
|
@ -703,8 +696,8 @@ class _Window(ArchComponent.Component):
|
||||||
if orig.Base:
|
if orig.Base:
|
||||||
base = orig.Base
|
base = orig.Base
|
||||||
if hasattr(orig,"HoleDepth"):
|
if hasattr(orig,"HoleDepth"):
|
||||||
if orig.HoleDepth:
|
if orig.HoleDepth.Value:
|
||||||
width = orig.HoleDepth
|
width = orig.HoleDepth.Value
|
||||||
if not width:
|
if not width:
|
||||||
if base:
|
if base:
|
||||||
b = base.Shape.BoundBox
|
b = base.Shape.BoundBox
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#* *
|
#* *
|
||||||
#***************************************************************************/
|
#***************************************************************************/
|
||||||
|
|
||||||
import FreeCAD, os, unittest, FreeCADGui, Arch, Draft
|
import FreeCAD, os, unittest, FreeCADGui, Arch, Draft, Part, Sketcher
|
||||||
|
|
||||||
class ArchTest(unittest.TestCase):
|
class ArchTest(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -44,9 +44,127 @@ class ArchTest(unittest.TestCase):
|
||||||
|
|
||||||
def testStructure(self):
|
def testStructure(self):
|
||||||
FreeCAD.Console.PrintLog ('Checking Arch Structure...\n')
|
FreeCAD.Console.PrintLog ('Checking Arch Structure...\n')
|
||||||
s = Arch.makeStructure(length=2,width=3,hright=5)
|
s = Arch.makeStructure(length=2,width=3,height=5)
|
||||||
self.failUnless(s,"Arch Structure failed")
|
self.failUnless(s,"Arch Structure failed")
|
||||||
|
|
||||||
|
def testRebar(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Rebar...\n')
|
||||||
|
s = Arch.makeStructure(length=2,width=3,height=5)
|
||||||
|
sk = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch')
|
||||||
|
sk.Support = (s,["Face6"])
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-0.85,1.25,0),FreeCAD.Vector(0.75,1.25,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(0.75,1.25,0),FreeCAD.Vector(0.75,-1.20,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(0.75,-1.20,0),FreeCAD.Vector(-0.85,-1.20,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-0.85,-1.20,0),FreeCAD.Vector(-0.85,1.25,0)))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1))
|
||||||
|
r = Arch.makeRebar(s,sk,diameter=.1,amount=2)
|
||||||
|
self.failUnless(r,"Arch Rebar failed")
|
||||||
|
|
||||||
|
def testFloor(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Floor...\n')
|
||||||
|
s = Arch.makeStructure(length=2,width=3,height=5)
|
||||||
|
f = Arch.makeFloor([s])
|
||||||
|
self.failUnless(f,"Arch Floor failed")
|
||||||
|
|
||||||
|
def testBuilding(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Building...\n')
|
||||||
|
s = Arch.makeStructure(length=2,width=3,height=5)
|
||||||
|
f = Arch.makeFloor([s])
|
||||||
|
b = Arch.makeBuilding([f])
|
||||||
|
self.failUnless(b,"Arch Building failed")
|
||||||
|
|
||||||
|
def testSite(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Site...\n')
|
||||||
|
s = Arch.makeStructure(length=2,width=3,height=5)
|
||||||
|
f = Arch.makeFloor([s])
|
||||||
|
b = Arch.makeBuilding([f])
|
||||||
|
si = Arch.makeSite([b])
|
||||||
|
self.failUnless(si,"Arch Site failed")
|
||||||
|
|
||||||
|
def testWindow(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Window...\n')
|
||||||
|
l=Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(-2,0,0))
|
||||||
|
w = Arch.makeWall(l)
|
||||||
|
sk = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch001')
|
||||||
|
sk.Support = (w,["Face3"])
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-1.80,1.30,0),FreeCAD.Vector(-0.90,1.30,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-0.90,1.30,0),FreeCAD.Vector(-0.90,0.25,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-0.90,0.25,0),FreeCAD.Vector(-1.80,0.25,0)))
|
||||||
|
sk.addGeometry(Part.Line(FreeCAD.Vector(-1.80,0.25,0),FreeCAD.Vector(-1.80,1.30,0)))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',0,2,1,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',2,2,3,1))
|
||||||
|
sk.addConstraint(Sketcher.Constraint('Coincident',3,2,0,1))
|
||||||
|
win = Arch.makeWindow(sk)
|
||||||
|
Arch.removeComponents(win,host=w)
|
||||||
|
self.failUnless(win,"Arch Window failed")
|
||||||
|
|
||||||
|
def testRoof(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Roof...\n')
|
||||||
|
r = Draft.makeRectangle(length=2,height=-1)
|
||||||
|
ro = Arch.makeRoof(r)
|
||||||
|
self.failUnless(ro,"Arch Roof failed")
|
||||||
|
|
||||||
|
def testAxis(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Axis...\n')
|
||||||
|
a = Arch.makeAxis()
|
||||||
|
self.failUnless(a,"Arch Axis failed")
|
||||||
|
|
||||||
|
def testSection(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Section...\n')
|
||||||
|
s = Arch.makeSectionPlane([])
|
||||||
|
v = Arch.makeSectionView(s)
|
||||||
|
self.failUnless(v,"Arch Section failed")
|
||||||
|
|
||||||
|
def testSpace(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Space...\n')
|
||||||
|
sb = Part.makeBox(1,1,1)
|
||||||
|
b = FreeCAD.ActiveDocument.addObject('Part::Feature','Box')
|
||||||
|
b.Shape = sb
|
||||||
|
s = Arch.makeSpace([b])
|
||||||
|
self.failUnless(s,"Arch Space failed")
|
||||||
|
|
||||||
|
def testStairs(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Stairs...\n')
|
||||||
|
s = Arch.makeStairs()
|
||||||
|
self.failUnless(s,"Arch Stairs failed")
|
||||||
|
|
||||||
|
def testFrame(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Frame...\n')
|
||||||
|
l=Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(-2,0,0))
|
||||||
|
p = Draft.makeRectangle(length=.5,height=.5)
|
||||||
|
f = Arch.makeFrame(l,p)
|
||||||
|
self.failUnless(f,"Arch Frame failed")
|
||||||
|
|
||||||
|
def testAdd(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Add...\n')
|
||||||
|
l=Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(2,0,0))
|
||||||
|
w = Arch.makeWall(l)
|
||||||
|
sb = Part.makeBox(1,1,1)
|
||||||
|
b = FreeCAD.ActiveDocument.addObject('Part::Feature','Box')
|
||||||
|
b.Shape = sb
|
||||||
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
Arch.addComponents(b,w)
|
||||||
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
r = (w.Shape.Volume > 1.5)
|
||||||
|
self.failUnless(r,"Arch Add failed")
|
||||||
|
|
||||||
|
def testRemove(self):
|
||||||
|
FreeCAD.Console.PrintLog ('Checking Arch Remove...\n')
|
||||||
|
l=Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(2,0,0))
|
||||||
|
w = Arch.makeWall(l)
|
||||||
|
sb = Part.makeBox(1,1,1)
|
||||||
|
b = FreeCAD.ActiveDocument.addObject('Part::Feature','Box')
|
||||||
|
b.Shape = sb
|
||||||
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
Arch.removeComponents(b,w)
|
||||||
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
r = (w.Shape.Volume < 0.75)
|
||||||
|
self.failUnless(r,"Arch Remove failed")
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
FreeCAD.closeDocument("ArchTest")
|
FreeCAD.closeDocument("ArchTest")
|
||||||
pass
|
pass
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user