当前位置: 首页>>代码示例>>Python>>正文


Python ArchWall.mergeShapes方法代码示例

本文整理汇总了Python中ArchWall.mergeShapes方法的典型用法代码示例。如果您正苦于以下问题:Python ArchWall.mergeShapes方法的具体用法?Python ArchWall.mergeShapes怎么用?Python ArchWall.mergeShapes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArchWall的用法示例。


在下文中一共展示了ArchWall.mergeShapes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processSubShapes

# 需要导入模块: import ArchWall [as 别名]
# 或者: from ArchWall import mergeShapes [as 别名]
    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
开发者ID:andrewjrobinson,项目名称:FreeCAD_sf_master,代码行数:57,代码来源:ArchComponent.py

示例2: processSubShapes

# 需要导入模块: import ArchWall [as 别名]
# 或者: from ArchWall import mergeShapes [as 别名]
    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
开发者ID:mangtronix,项目名称:FreeCAD_mangtronix,代码行数:94,代码来源:ArchComponent.py

示例3: processSubShapes

# 需要导入模块: import ArchWall [as 别名]
# 或者: from ArchWall import mergeShapes [as 别名]
    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
开发者ID:FRidh,项目名称:FreeCAD_sf_master,代码行数:79,代码来源:ArchComponent.py

示例4: processSubShapes

# 需要导入模块: import ArchWall [as 别名]
# 或者: from ArchWall import mergeShapes [as 别名]
    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
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:101,代码来源:ArchComponent.py


注:本文中的ArchWall.mergeShapes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。