def __init__(self, myclasswithoptimizablevariables, doc=None, super_group=None): if doc is None: self.Document = newDocument() else: self.Document = doc if super_group is None: self.SuperGroup = None else: self.SuperGroup = super_group # create subgroup in super_group or if None create group in doc # every class with optimizable variables should get one group self.Group = self.Document.addObject("App::DocumentObjectGroup", myclasswithoptimizablevariables.name) if self.SuperGroup is not None: self.SuperGroup.addObject(self.Group)
import sys FREECADPATH = '/usr/lib/freecad/lib/' sys.path.append(FREECADPATH) from FreeCAD import Base, newDocument import Part import Draft import ProfileLib.RegularPolygon as Poly import MeshPart doc = newDocument() radius = 0.01 height = 0.1 cyl = doc.addObject("Part::Cylinder", "cyl") cyl.Radius = radius cyl.Height = height sph = doc.addObject("Part::Sphere", "sph") sph.Radius = radius uni = doc.addObject("Part::MultiFuse", "uni") uni.Shapes = [cyl, sph] ske = doc.addObject('Sketcher::SketchObject', 'Sketch') ske.Placement = Base.Placement(Base.Vector(0.0, 0.0, 0.0), Base.Rotation(-0.707107, 0.0, 0.0, -0.707107)) Poly.makeRegularPolygon('Sketch', 5, Base.Vector(-1.2 * radius, 0.9 * height, 0),
import sys FREECADPATH = '/usr/lib/freecad/lib/' sys.path.append(FREECADPATH) from FreeCAD import Base, newDocument import Part import Draft import ProfileLib.RegularPolygon as Poly import MeshPart doc = newDocument() radius = 0.01 height = 0.1 cyl = doc.addObject("Part::Cylinder", "cyl") cyl.Radius = radius cyl.Height = height sph = doc.addObject("Part::Sphere", "sph") sph.Radius = radius uni = doc.addObject("Part::MultiFuse", "uni") uni.Shapes = [cyl, sph] ske = doc.addObject('Sketcher::SketchObject', 'Sketch') ske.Placement = Base.Placement(Base.Vector(0, 0, 0), Base.Rotation(-0.707107, 0, 0, -0.707107)) Poly.makeRegularPolygon('Sketch', 5, Base.Vector(-1.2 * radius, 0.9 * height, 0),