def createChamferBox(doc, shape, box, mat, mtx): FreeCAD.Console.PrintMessage("building 'ChamferBox' ... ") pBlock = getReferences(box)[0] # length (float) [2] # width (float) [3] # height (float) [4] # fillet (float) [5] # segments length (int) [6] # segments height (int) [7] # segments width (int) [8] # segments fillet (int) [9] # general mapping (bool) [A] # real world map size (bool) [B] # smoothing (bool) [C] name = shape.getFirst(0x0962).data cube = doc.addObject("Part::Box", getValidName(name) + '_b') cube.Label = name + '_b' cube.Length = pBlock.children[2].getFirst(0x0100).data[0] cube.Width = pBlock.children[3].getFirst(0x0100).data[0] cube.Height = pBlock.children[4].getFirst(0x0100).data[0] f = pBlock.children[5].getFirst(0x0100).data[0] # chmfr = doc.addObject("Part::Chamfer", getValidName(name)) # adjustPlacement(cube, mtx) # chmfr.Base = cube # myEdges = [] # for i in xrange(12): # myEdges.append(( i+1, fillet, fillet)) # (edge number, chamfer start length, chamfer end length) # chmfr.Edges = myEdges # cube.ViewObject.Visibility = False return True
def createSphere(doc, shape, cylinder, mat, mtx): FreeCAD.Console.PrintMessage("building 'Sphere' ... ") pBlock = getReferences(cylinder)[0] # radius (float) [2] # height (float) [3] # real world map size (bool) [4] # general mapping (bool) [5] # segments height (int) [6] # segments cap (int) [7] # slice (bool) [8] # sliceFrom (float) [9] # smoothing (bool) [A] # sliceTo float) [B] name = shape.getFirst(0x0962).data obj = doc.addObject("Part::Sphere", getValidName(name)) obj.Label = name obj.Radius = pBlock.children[2].getFirst(0x0100).data[0] adjustPlacement(obj, mtx) return True
def createBox(doc, shape, box, mat, mtx): FreeCAD.Console.PrintMessage("building 'Box' ... ") pBlock = getReferences(box)[0] # length (float) [2] # width (float) [3] # height (float) [4] # segments length (int) [5] # segments width (int) [6] # segments height (int) [7] # general mapping (bool) [8] # real world map size (bool) [9] name = shape.getFirst(0x0962).data obj = doc.addObject("Part::Box", getValidName(name)) obj.Label = name obj.Length = pBlock.children[2].getFirst(0x0100).data[0] obj.Width = pBlock.children[3].getFirst(0x0100).data[0] obj.Height = pBlock.children[4].getFirst(0x0100).data[0] adjustPlacement(obj, mtx) return True
def createDocObject(doc, name, creator): obj = doc.addObject(creator, getValidName(name)) obj.Label = name return obj