예제 #1
0
 def Activated(self):
     from GDMLObjects import GDMLEllipsoid, ViewProvider
     a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython", \
               "GDMLEllipsoid")
     print("GDMLEllipsoid Object - added")
     #  obj,ax, by, cz, zcut1, zcut2, lunit,material
     GDMLEllipsoid(a,10,20,30,0,0,"mm",0)
     print("GDMLEllipsoid initiated")
     ViewProvider(a.ViewObject)
     print("GDMLEllipsoid ViewProvided - added")
     FreeCAD.ActiveDocument.recompute()
     FreeCADGui.SendMsgToActiveView("ViewFit")
예제 #2
0
def createEllipsoid(part,solid,material,px,py,pz,rot,displayMode) :
    from GDMLObjects import GDMLEllipsoid, ViewProvider
    GDMLShared.trace("CreateElTube : ")
    GDMLShared.trace(solid.attrib)
    ax = GDMLShared.getVal(solid,'ax')
    by = GDMLShared.getVal(solid,'by')
    cz = GDMLShared.getVal(solid,'cz')
    zcut1 = GDMLShared.getVal(solid,'zcut1')
    zcut2 = GDMLShared.getVal(solid,'zcut2')
    lunit = getText(solid,'lunit',"mm")
    #myelli=volObj.newObject("Part::FeaturePython","GDMLEllipsoid:"+getName(solid))
    myelli=part.newObject("Part::FeaturePython","GDMLEllipsoid:"+getName(solid))
    # cuts 0 for now
    GDMLEllipsoid(myelli,ax, by, cz,zcut1,zcut2,lunit,material)
    GDMLShared.trace("CreateEllipsoid : ")
    GDMLShared.trace("Position : "+str(px)+','+str(py)+','+str(pz))
    base = FreeCAD.Vector(px,py,pz)
    myelli.Placement = GDMLShared.processPlacement(base,rot)
    GDMLShared.trace(myelli.Placement.Rotation)
    # set ViewProvider before setDisplay
    ViewProvider(myelli.ViewObject)
    setDisplayMode(myelli,displayMode)
    return myelli