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)
Esempio n. 2
0
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)
Esempio n. 3
0
 def create_wall(self):
     sel = Gui.Selection.getSelection()
     slabs = []
     for s in sel:
         if (hasattr(s, "Proxy") and hasattr(s.Proxy, "Type")
                 and s.Proxy.Type == "Beam"):
             slabs.append(s)
     if not slabs:
         return None
     weight = self.form.weight.value()
     height = self.form.height_box.value()
     create_blocks = self.form.create_blocks.isChecked()
     loadpat = self.form.loadpat.currentText()
     mat = FreeCAD.ActiveDocument.findObjects(
         Type='App::MaterialObjectPython')
     if not mat:
         import Arch
         mat = Arch.makeMaterial('Bricks')
         mat.Color = (0.89, .89, 0.)
     else:
         mat = mat[0]
     for s in slabs:
         wall = ArchWall.makeWall(baseobj=s, height=height * 1000)
         wall.addProperty('App::PropertyInteger', 'weight', 'Wall')
         wall.addProperty('App::PropertyString', 'loadpat', 'Wall')
         wall.loadpat = loadpat
         wall.weight = weight
         wall.Base.ViewObject.Visibility = True
         wall.Material = mat
         wall.Width = 300
         if create_blocks:
             wall.MakeBlocks = True
             wall.BlockHeight = 400
             wall.BlockLength = 800
             wall.OffsetSecond = 400
             wall.Joint = 40
             wall.ViewObject.DisplayMode = 'Flat Lines'
             wall.ViewObject.LineWidth = 1
         else:
             wall.ViewObject.DisplayMode = 'Shaded'
             wall.ViewObject.Transparency = 60
     FreeCAD.ActiveDocument.recompute()