Esempio n. 1
0
    def onChanged(self, obj, prop):

        ArchIFC.onChanged(obj, prop)
        if prop == "Terrain":
            if obj.Terrain:
                if FreeCAD.GuiUp:
                    obj.Terrain.ViewObject.hide()
                self.execute(obj)
Esempio n. 2
0
    def onChanged(self,obj,prop):

        ArchIFC.onChanged(obj, prop)
        if prop == "Terrain":
            if obj.Terrain:
                if FreeCAD.GuiUp:
                    obj.Terrain.ViewObject.hide()
                self.execute(obj)
Esempio n. 3
0
    def onChanged(self, obj, prop):
        ArchIFC.onChanged(obj, prop)

        ArchFloor._Floor.onChanged(self, obj, prop)
        if prop == "Terrain":
            if obj.Terrain:
                if FreeCAD.GuiUp:
                    obj.Terrain.ViewObject.hide()
                self.execute(obj)
        if prop in ["UpdateDeclination", "CompassRotation", "Placement"]:
            self.updateDeclination()
Esempio n. 4
0
    def onChanged(self, obj, prop):

        ArchIFC.onChanged(obj, prop)

        if prop == "Height":
            for child in obj.Group:
                if Draft.getType(child) in ["Wall", "Structure"]:
                    if not child.Height.Value:
                        #print("Executing ",child.Label)
                        child.Proxy.execute(child)

        elif prop == "Placement":
            if hasattr(self, "oldPlacement"):
                if self.oldPlacement:
                    deltap = obj.Placement.Base.sub(self.oldPlacement.Base)
                    if deltap.Length == 0:
                        deltap = None
                    v = FreeCAD.Vector(0, 0, 1)
                    deltar = FreeCAD.Rotation(
                        self.oldPlacement.Rotation.multVec(v),
                        obj.Placement.Rotation.multVec(v))
                    #print "Rotation",deltar.Axis,deltar.Angle
                    if deltar.Angle < 0.0001:
                        deltar = None
                    for child in obj.Group:
                        if ((not hasattr(child, "MoveWithHost"))
                                or child.MoveWithHost) and hasattr(
                                    child, "Placement"):
                            #print "moving ",child.Label
                            if deltar:
                                #child.Placement.Rotation = child.Placement.Rotation.multiply(deltar) - not enough, child must also move
                                # use shape methods to obtain a correct placement
                                import Part, math
                                shape = Part.Shape()
                                shape.Placement = child.Placement
                                #print("angle before rotation:",shape.Placement.Rotation.Angle)
                                #print("rotation angle:",math.degrees(deltar.Angle))
                                shape.rotate(
                                    DraftVecUtils.tup(obj.Placement.Base),
                                    DraftVecUtils.tup(deltar.Axis),
                                    math.degrees(deltar.Angle))
                                #print("angle after rotation:",shape.Placement.Rotation.Angle)
                                child.Placement = shape.Placement
                            if deltap:
                                child.Placement.move(deltap)

        elif prop == "Group":
            obj.Area = self.getArea(obj)
    def onChanged(self,obj,prop):

        ArchIFC.onChanged(obj, prop)

        if prop == "Height":
            for child in obj.Group:
                if Draft.getType(child) in ["Wall","Structure"]:
                    if not child.Height.Value:
                        #print("Executing ",child.Label)
                        child.Proxy.execute(child)

        elif prop == "Placement":
            if hasattr(self,"oldPlacement"):
                if self.oldPlacement:
                    deltap = obj.Placement.Base.sub(self.oldPlacement.Base)
                    if deltap.Length == 0:
                        deltap = None
                    v = FreeCAD.Vector(0,0,1)
                    deltar = FreeCAD.Rotation(self.oldPlacement.Rotation.multVec(v),obj.Placement.Rotation.multVec(v))
                    #print "Rotation",deltar.Axis,deltar.Angle
                    if deltar.Angle < 0.0001:
                        deltar = None
                    for child in obj.Group:
                        if ((not hasattr(child,"MoveWithHost")) or child.MoveWithHost) and hasattr(child,"Placement"):
                            #print "moving ",child.Label
                            if deltar:
                                #child.Placement.Rotation = child.Placement.Rotation.multiply(deltar) - not enough, child must also move
                                # use shape methods to obtain a correct placement
                                import Part,math
                                shape = Part.Shape()
                                shape.Placement = child.Placement
                                #print("angle before rotation:",shape.Placement.Rotation.Angle)
                                #print("rotation angle:",math.degrees(deltar.Angle))
                                shape.rotate(DraftVecUtils.tup(obj.Placement.Base), DraftVecUtils.tup(deltar.Axis), math.degrees(deltar.Angle))
                                #print("angle after rotation:",shape.Placement.Rotation.Angle)
                                child.Placement = shape.Placement
                            if deltap:
                                child.Placement.move(deltap)