def execute(self, fp): #arguments are ignored maxmeshpoints = None #TBD: add as property import Part, OpenSCADUtils shape = OpenSCADUtils.process_ObjectsViaOpenSCADShape(fp.Document,fp.Children,\ fp.Operation, maxmeshpoints=maxmeshpoints) if shape: fp.Shape = shape else: raise ValueError
def execute(self,fp): #arguments are ignored maxmeshpoints = None #TBD: add as property import Part,OpenSCADUtils shape = OpenSCADUtils.process_ObjectsViaOpenSCADShape(fp.Document,fp.Children,\ fp.Operation, maxmeshpoints=maxmeshpoints) if shape: fp.Shape = shape else: raise ValueError
def createHull(group): hShape = None obj0 = group[0] if len(group) == 2: obj1 = group[1] checkObjShape(obj0) checkObjShape(obj1) print('Check 2D') if chk2D(obj0) and chk2D(obj1): if obj0.Radius == obj1.Radius: return hullTwoEqCircles(obj0, obj1) else: return hullTwoCircles(obj0, obj1) if obj0.TypeId == 'Part::Sphere' and obj1.TypeId == 'Part::Sphere': return hullTwoSpheres(obj0, obj1) if chkParallel(group): print('Parallel') if chkCollinear(group): print('Collinear') if chkCircular(group): print('Circular') pointLst = [] for obj in group: h, r1, r2 = getCircularDetails(obj) #print('h : '+str(h)) ax1 = obj.Placement.Rotation.multVec( FreeCAD.Vector(0, 0, 1)) #print('ax1 : '+str(ax1)) ax = obj.Placement.Base.dot(ax1) #print('ax : '+str(ax)) bx = ax + h pointLst.append(FreeCAD.Vector(0, 0, ax)) pointLst.append(FreeCAD.Vector(0, r1, ax)) pointLst.append(FreeCAD.Vector(0, r2, bx)) pointLst.append(FreeCAD.Vector(0, 0, bx)) print(pointLst) revHull = createRevolveHull(pointLst) # rotate from z-axis to collinear axis revHull.Placement.Rotation = obj0.Placement.Rotation print(obj0.Placement.Rotation) print(revHull.Placement.Rotation) return revHull if len(group) == 2: obj0 = group[0] obj1 = group[1] if chkOrthoganal(obj0, obj1): print('Orthoganal') if obj0.TypeId == 'Part::Cylinder' and \ obj1.TypeId == 'Part::Cylinder' : if obj0.Height == obj1.Height: print('Hull two Cyls') face = hullTwoCircles(obj0, obj1) return face.extrude( FreeCAD.Vector(0, 0, obj0.Height.Value)) print('Not directly handled') #from OpenSCADFeatures import CGALFeature #myObj = FreeCAD.ActiveDocument.addObject('Part::FeaturePython','Fred') #CGALFeature(myObj,'hull',obj.Group) # import OpenSCADFeatures #return myObj.Shape import OpenSCADUtils print('Process OpenSCAD Shapes via OpenSCAD') return OpenSCADUtils.process_ObjectsViaOpenSCADShape(FreeCAD.ActiveDocument,\ group,'hull',maxmeshpoints=None)