本文整理汇总了Python中ArchWall类的典型用法代码示例。如果您正苦于以下问题:Python ArchWall类的具体用法?Python ArchWall怎么用?Python ArchWall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArchWall类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeShape
def removeShape(objs, mark=True):
"""takes an arch object (wall or structure) built on a cubic shape, and removes
the inner shape, keeping its length, width and height as parameters."""
import DraftGeomUtils
if not isinstance(objs, list):
objs = [objs]
for obj in objs:
if DraftGeomUtils.isCubic(obj.Shape):
dims = DraftGeomUtils.getCubicDimensions(obj.Shape)
if dims:
name = obj.Name
tp = Draft.getType(obj)
print tp
if tp == "Structure":
FreeCAD.ActiveDocument.removeObject(name)
import ArchStructure
str = ArchStructure.makeStructure(length=dims[1], width=dims[2], height=dims[3], name=name)
str.Placement = dims[0]
elif tp == "Wall":
FreeCAD.ActiveDocument.removeObject(name)
import ArchWall
length = dims[1]
width = dims[2]
v1 = Vector(length / 2, 0, 0)
v2 = v1.negative()
v1 = dims[0].multVec(v1)
v2 = dims[0].multVec(v2)
line = Draft.makeLine(v1, v2)
wal = ArchWall.makeWall(line, width=width, height=dims[3], name=name)
else:
if mark:
obj.ViewObject.ShapeColor = (1.0, 0.0, 0.0, 1.0)
示例2: processSubShapes
def processSubShapes(self,obj,base):
"Adds additions and subtractions to a base shape"
import Draft
# treat additions
for o in obj.Additions:
if base:
if base.isNull():
base = None
# special case, both walls with coinciding endpoints
import ArchWall
js = ArchWall.mergeShapes(o,obj)
if js:
add = js.cut(base)
base = base.fuse(add)
elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids:
if base:
if base.Solids:
base = base.fuse(o.Shape)
else:
base = o.Shape
# treat subtractions
for o in obj.Subtractions:
if base:
if base.isNull():
base = None
if base:
if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
# windows can be additions or subtractions, treated the same way
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids and base.Solids:
base = base.cut(o.Shape)
return base
示例3: processSubShapes
def processSubShapes(self,obj,base,placement=None):
"Adds additions and subtractions to a base shape"
import Draft,Part
#print "Processing subshapes of ",obj.Label, " : ",obj.Additions
if placement:
if placement.isNull():
placement = None
else:
placement = FreeCAD.Placement(placement)
placement = placement.inverse()
# treat additions
for o in obj.Additions:
if not base:
if o.isDerivedFrom("Part::Feature"):
base = o.Shape
else:
if base.isNull():
if o.isDerivedFrom("Part::Feature"):
base = o.Shape
else:
# special case, both walls with coinciding endpoints
import ArchWall
js = ArchWall.mergeShapes(o,obj)
if js:
add = js.cut(base)
if placement:
add.Placement = add.Placement.multiply(placement)
base = base.fuse(add)
elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
if placemen:
f.Placement = f.Placement.multiply(placement)
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids:
s = o.Shape.copy()
if placement:
s.Placement = s.Placement.multiply(placement)
if base:
if base.Solids:
try:
base = base.fuse(s)
except:
print "Arch: unable to fuse object ",obj.Name, " with ", o.Name
else:
base = s
# treat subtractions
for o in obj.Subtractions:
if base:
if base.isNull():
base = None
if base:
if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
# windows can be additions or subtractions, treated the same way
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
if placement:
f.Placement = f.Placement.multiply(placement)
base = base.cut(f)
elif (Draft.getType(o) == "Roof") or (Draft.isClone(o,"Roof")):
# roofs define their own special subtraction volume
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids and base.Solids:
s = o.Shape.copy()
if placement:
s.Placement = s.Placement.multiply(placement)
try:
base = base.cut(s)
except:
print "Arch: unable to cut object ",o.Name, " from ", obj.Name
return base
示例4: processSubShapes
def processSubShapes(self,obj,base):
"Adds additions and subtractions to a base shape"
import Draft
# treat additions
for o in obj.Additions:
if base:
if base.isNull():
base = None
# special case, both walls with coinciding endpoints
import ArchWall
js = ArchWall.mergeShapes(o,obj)
if js:
add = js.cut(base)
base = base.fuse(add)
elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
if base:
# windows can be additions or subtractions, treated the same way
if hasattr(self,"Width"):
width = self.Width
else:
b = base.BoundBox
width = max(b.XLength,b.YLength,b.ZLength)
if Draft.isClone(o,"Window"):
window = o.Objects[0]
else:
window = o
if window.Base and width:
f = self.getSubVolume(window.Base,width)
if f:
if base.Solids and f.Solids:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids:
if base:
if base.Solids:
base = base.fuse(o.Shape)
else:
base = o.Shape
# treat subtractions
for o in obj.Subtractions:
if base:
if base.isNull():
base = None
if base:
if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")):
# windows can be additions or subtractions, treated the same way
if hasattr(self,"Width"):
width = self.Width
else:
b = base.BoundBox
width = max(b.XLength,b.YLength,b.ZLength)
if Draft.isClone(o,"Window"):
window = o.Objects[0]
else:
window = o
if window.Base and width:
f = self.getSubVolume(window.Base,width)
if f:
if base.Solids and f.Solids:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids and base.Solids:
base = base.cut(o.Shape)
return base
示例5: processSubShapes
def processSubShapes(self,obj,base,placement=None):
"Adds additions and subtractions to a base shape"
import Draft,Part
#print("Processing subshapes of ",obj.Label, " : ",obj.Additions)
if placement:
if placement.isIdentity():
placement = None
else:
placement = FreeCAD.Placement(placement)
placement = placement.inverse()
# treat additions
for o in obj.Additions:
if not base:
if o.isDerivedFrom("Part::Feature"):
base = o.Shape
else:
if base.isNull():
if o.isDerivedFrom("Part::Feature"):
base = o.Shape
else:
# special case, both walls with coinciding endpoints
import ArchWall
js = ArchWall.mergeShapes(o,obj)
if js:
add = js.cut(base)
if placement:
add.Placement = add.Placement.multiply(placement)
base = base.fuse(add)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids:
s = o.Shape.copy()
if placement:
s.Placement = s.Placement.multiply(placement)
if base:
if base.Solids:
try:
base = base.fuse(s)
except Part.OCCError:
print("Arch: unable to fuse object ", obj.Name, " with ", o.Name)
else:
base = s
# treat subtractions
subs = obj.Subtractions
for link in obj.InList:
if hasattr(link,"Hosts"):
for host in link.Hosts:
if host == obj:
subs.append(link)
for o in subs:
if base:
if base.isNull():
base = None
if base:
if (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window",True)):
# windows can be additions or subtractions, treated the same way
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
if placement:
f.Placement = f.Placement.multiply(placement)
if len(base.Solids) > 1:
base = Part.makeCompound([sol.cut(f) for sol in base.Solids])
else:
base = base.cut(f)
elif (Draft.getType(o) == "Roof") or (Draft.isClone(o,"Roof")):
# roofs define their own special subtraction volume
f = o.Proxy.getSubVolume(o)
if f:
if base.Solids and f.Solids:
if len(base.Solids) > 1:
base = Part.makeCompound([sol.cut(f) for sol in base.Solids])
else:
base = base.cut(f)
elif o.isDerivedFrom("Part::Feature"):
if o.Shape:
if not o.Shape.isNull():
if o.Shape.Solids and base.Solids:
s = o.Shape.copy()
if placement:
s.Placement = s.Placement.multiply(placement)
try:
if len(base.Solids) > 1:
base = Part.makeCompound([sol.cut(s) for sol in base.Solids])
else:
base = base.cut(s)
except Part.OCCError:
print("Arch: unable to cut object ",o.Name, " from ", obj.Name)
return base