Python FreeCADGui.ActiveDocument() Examples

The following are 30 code examples of FreeCADGui.ActiveDocument(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module FreeCADGui , or try the search function .
Example #1
Source File: Animation.py    From Animation with GNU General Public License v2.0 7 votes vote down vote up
def rot(self,angle=0):
		FreeCAD.uu=self
		#say("rotate " + str(self.obj2.Label) + " angle=" +str(angle))
		if self.obj2.ModeMotion =='Vector':
			#say(self.obj2.vectorMotion)
			
			a=FreeCAD.Placement()
			a.Base=self.obj2.vectorMotion
			zzz=FreeCAD.Rotation(FreeCAD.Vector(0,0,1),angle)
			r=FreeCAD.Placement()
			r.Rotation=FreeCAD.Rotation(FreeCAD.Vector(0,0,1),angle)
			a2=r.multiply(a)
			
			self.obj2.vectorMotion=a2.Base
			FreeCAD.ActiveDocument.recompute()
					
			# self.obj2.vectorMotion=multiply(self.obj2.vectorMotion)
			#say(self.obj2.vectorMotion) 
Example #2
Source File: Animation.py    From Animation with GNU General Public License v2.0 6 votes vote down vote up
def createMoviescreen(name='My_Moviescreen'):

	obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
	obj.addProperty("App::PropertyIntegerList","pictureStart","info","Rotationsachse Zentrum relativ").pictureStart=[0,50,100]
	obj.addProperty("App::PropertyPath","pictures","screen","text").pictures="/home/microelly2/pics/t%04.f.png"
	obj.addProperty("App::PropertyLink","rectangle","screen","moving object ")

	obj.rectangle = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Rectangle Moviescreen")
	Draft._Rectangle(obj.rectangle)
	obj.rectangle.Length = 64
	obj.rectangle.Height = 48
	obj.rectangle.MakeFace = True
	Draft._ViewProviderRectangle(obj.rectangle.ViewObject)
	tx=FreeCADGui.activeDocument().activeView()
	rx=tx.getCameraOrientation()
	obj.rectangle.Placement.Rotation=rx
	_Moviescreen(obj)
	return obj 
Example #3
Source File: Animation.py    From Animation with GNU General Public License v2.0 6 votes vote down vote up
def createBounder(name='MyBounder'):
	obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)

	obj.addProperty("App::PropertyInteger","start","Base","start").start=10
	obj.addProperty("App::PropertyInteger","end","Base","end").end=40
	obj.addProperty("App::PropertyInteger","duration","Base","end")

	obj.addProperty("App::PropertyLink","obj","Object","Objekt")

	obj.addProperty("App::PropertyBool","x","intervall","start").x=False
	obj.addProperty("App::PropertyFloat","xmin","intervall","va")
	obj.addProperty("App::PropertyFloat","xmax","intervall","ve")

	obj.addProperty("App::PropertyBool","y","intervall","start").y=False
	obj.addProperty("App::PropertyFloat","ymin","intervall","va")
	obj.addProperty("App::PropertyFloat","ymax","intervall","ve")

	obj.addProperty("App::PropertyBool","z","intervall","start").z=False
	obj.addProperty("App::PropertyFloat","zmin","intervall","va")
	obj.addProperty("App::PropertyFloat","zmax","intervall","ve")

## mod
	_Bounder(obj,'/icons/bounder.png')
	_ViewProviderActor(obj.ViewObject,'/icons/bounder.png') 
	return obj 
Example #4
Source File: NiCrInit.py    From NiCr with GNU General Public License v2.0 6 votes vote down vote up
def Activated(self):
        # retrieve Selection
        selection = FreeCAD.Gui.Selection.getSelectionEx()
        for i in range(len(selection)):
            # create WirePath folder if it does not exist
            try:
                WPFolder = FreeCAD.ActiveDocument.WirePath

            except:
                WPFolder = FreeCAD.ActiveDocument.addObject('App::DocumentObjectGroupPython', 'WirePath')
                NiCrPath.WirePathFolder(WPFolder)
                NiCrPath.WirePathViewProvider(WPFolder)

            # create shapepath object
            selObj = selection[i].Object
            shapepath_name = 'ShapePath_' + selObj.Name
            shapepathobj = FreeCAD.ActiveDocument.addObject('Part::FeaturePython', shapepath_name)
            # initialize python object
            NiCrPath.ShapePath(shapepathobj, selObj)
            NiCrPath.ShapePathViewProvider(shapepathobj.ViewObject)
            # modify color
            shapepathobj.ViewObject.ShapeColor = (1.0, 1.0, 1.0)
            shapepathobj.ViewObject.LineWidth = 1.0
            WPFolder.addObject(shapepathobj) 
Example #5
Source File: SheetMetalUnfolder.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 6 votes vote down vote up
def sew_Shape():
    """checking Shape"""

    doc=FreeCAD.ActiveDocument
    docG = FreeCADGui.ActiveDocument

    sel=FreeCADGui.Selection.getSelection()
    if len (sel) == 1:
        o = sel[0]
        if hasattr(o,'Shape'):
            sh = o.Shape.copy()
            sh.sewShape()
            sl = Part.Solid(sh)
            docG.getObject(o.Name).Visibility = False
            Part.show(sl)
            ao = FreeCAD.ActiveDocument.ActiveObject
            ao.Label = 'Solid'
            docG.ActiveObject.ShapeColor=docG.getObject(o.Name).ShapeColor
            docG.ActiveObject.LineColor=docG.getObject(o.Name).LineColor
            docG.ActiveObject.PointColor=docG.getObject(o.Name).PointColor
            docG.ActiveObject.DiffuseColor=docG.getObject(o.Name).DiffuseColor
            docG.ActiveObject.Transparency=docG.getObject(o.Name).Transparency
    else:
        FreeCAD.Console.PrintError('select only one object') 
Example #6
Source File: pipeFeatures.py    From flamingo with GNU Lesser General Public License v3.0 6 votes vote down vote up
def execute(self, fp):
    if len(fp.Tubes)!=len(fp.Base.Shape.Edges):
      self.purge(fp)
      self.redraw(fp)
      return
    from math import tan
    for i in range(len(fp.Tubes)):
      L=fp.Base.Shape.Edges[i].Length
      R=fp.BendRadius
      # adjust the curve
      if i<len(fp.Curves):
        c=FreeCAD.ActiveDocument.getObject(fp.Curves[i])
        v1,v2=[e.tangentAt(0) for e in fp.Base.Shape.Edges[i:i+2]]
        pipeCmd.placeTheElbow(c,v1,v2) 
        alfa=float(v1.getAngle(v2))/2
        L-=float(R*tan(alfa)) 
      # adjust the pipes
      if i: 
        v1,v2=[e.tangentAt(0) for e in fp.Base.Shape.Edges[i-1:i+1]]
        alfa=float(v1.getAngle(v2))/2
        tang=float(R*tan(alfa)) 
        L-=tang
        FreeCAD.ActiveDocument.getObject(fp.Tubes[i]).AttachmentOffset.Base=FreeCAD.Vector(0,0,tang)
      FreeCAD.ActiveDocument.getObject(fp.Tubes[i]).Height=L 
Example #7
Source File: pipeFeatures.py    From flamingo with GNU Lesser General Public License v3.0 6 votes vote down vote up
def onChanged(self, fp, prop):
    if prop=='Base' and hasattr(fp,'OD') and hasattr(fp,'thk') and hasattr(fp,'BendRadius'):
      self.purge(fp)
      self.redraw(fp)
    if prop=='BendRadius' and hasattr(fp,'Curves'):
      BR=fp.BendRadius
      for curve in [FreeCAD.ActiveDocument.getObject(name) for name in fp.Curves]:
        curve.BendRadius=BR
    if prop=='OD' and hasattr(fp,'Tubes') and hasattr(fp,'Curves'):
      OD=fp.OD
      for obj in [FreeCAD.ActiveDocument.getObject(name) for name in fp.Tubes+fp.Curves]:
        if obj.PType=='Elbow': obj.BendRadius=OD*.75
        obj.OD=OD
      fp.BendRadius=OD*.75
    if prop=='thk' and hasattr(fp,'Tubes') and hasattr(fp,'Curves'):
      thk=fp.thk
      for obj in [FreeCAD.ActiveDocument.getObject(name) for name in fp.Tubes+fp.Curves]:
        if hasattr(obj,'thk'): obj.thk=thk 
Example #8
Source File: ParametricBlendCurve.py    From CurvesWB with GNU Lesser General Public License v2.1 6 votes vote down vote up
def build(self):
        self.active = False
        if not hasattr(self,'switch'):
            self.sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
            self.switch = coin.SoSwitch()
            if hasattr(self,'Object'):
                self.switch.setName("%s_ControlPoints"%self.Object.Name)
            self.empty = coin.SoSeparator() # Empty node
            self.node = coin.SoSeparator()
            self.coord = CoinNodes.coordinate3Node()
            self.poly = CoinNodes.polygonNode((0.5,0.5,0.5),1)
            self.marker = CoinNodes.markerSetNode((1,0,0),coin.SoMarkerSet.DIAMOND_FILLED_7_7)
            self.node.addChild(self.coord)
            self.node.addChild(self.poly)
            self.node.addChild(self.marker)
            self.switch.addChild(self.empty)
            self.switch.addChild(self.node)
            self.sg.addChild(self.switch) 
Example #9
Source File: ParametricBlendCurve.py    From CurvesWB with GNU Lesser General Public License v2.1 6 votes vote down vote up
def Activated(self):
        try:
            s = FreeCADGui.activeWorkbench().Selection
        except AttributeError:
            s = FreeCADGui.Selection.getSelectionEx()
        edges, param = self.parseSel(s)
        if len(edges) > 1:
            for j in range(int(len(edges)/2)):
                i = j*2
                obj=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Blend Curve") #add object to document
                BlendCurveFP(obj,edges[i:i+2])
                BlendCurveVP(obj.ViewObject)
                obj.Parameter1 = self.normalizedParam(edges[i], param[i], False)
                obj.Parameter2 = self.normalizedParam(edges[i+1], param[i+1], False)
                obj.Continuity1 = "G1"
                obj.Continuity2 = "G1"
                obj.Output = "Single"
                ori1, ori2 = self.getOrientation(edges[i], param[i], edges[i+1], param[i+1])
                obj.Scale1 = ori1
                obj.Scale2 = ori2
        FreeCAD.ActiveDocument.recompute() 
Example #10
Source File: Commands.py    From NodeEditor with MIT License 6 votes vote down vote up
def ConeTorusBoxandImagenode():

    instance=pfwrap.getInstance()
    clearGraph()
    gg=pfwrap.getGraphManager().getAllGraphs()[0]

    FreeCAD.ActiveDocument.addObject("Part::Cone","Cone")
    FreeCAD.ActiveDocument.addObject("Part::Torus","Torus")
    FreeCAD.ActiveDocument.addObject("Part::Box","Box")

    t = pfwrap.createNode('PyFlowBase',"imageDisplay","ImageXX")
    t.setPosition(-100,-200)
    t.entity.setData('/home/thomas/Bilder/freeka.png')
    t.compute()
    #t.setData("shapeOnly",True)
    gg.addNode(t)

    refresh_gui() 
Example #11
Source File: InitGui.py    From NodeEditor with MIT License 6 votes vote down vote up
def Activated(self):

        import re
        ta=False
        if ta:
            FreeCAD.ActiveDocument.openTransaction(self.name)
        if self.command != '':
            if self.modul != '':
                modul = self.modul
            else:
                modul = self.name
                
            Gui.doCommand('from importlib import reload')
            Gui.doCommand("import " + modul)
            Gui.doCommand("import " + self.lmod)
            Gui.doCommand("reload(" + self.lmod+")")
            Gui.doCommand(self.command)
        if ta:
            FreeCAD.ActiveDocument.commitTransaction()
        if FreeCAD.ActiveDocument != None:
            FreeCAD.ActiveDocument.recompute() 
Example #12
Source File: SheetMetalUnfolder.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 5 votes vote down vote up
def generateSketch(self, edges, name, color):
        docG = FreeCADGui.ActiveDocument
        p = Part.makeCompound(edges)
        try:
            sk = Draft.makeSketch(p.Edges, autoconstraints = True,addTo=None,delete=False,name=name)
            sk.Label = name
        except:
            doc = FreeCAD.ActiveDocument
            skb = doc.ActiveObject
            doc.removeObject(skb.Name)
            SMWarning("discretizing Sketch")
            sk = SMmakeSketchfromEdges(p.Edges,name)
        docG.getObject(sk.Name).LineColor = color
        docG.getObject(sk.Name).PointColor = color 
Example #13
Source File: SheetMetalUnfolder.py    From FreeCAD_SheetMetal with GNU General Public License v3.0 5 votes vote down vote up
def makeSolidExpSTEP():

    doc=FreeCAD.ActiveDocument
    docG = FreeCADGui.ActiveDocument
    if doc is not None:
        fname = doc.FileName
        if len(fname) == 0:
            fileNm='untitled'
        else:
            fileNm = os.path.basename(fname)
            fileNm = os.path.splitext(fileNm)[0]
        tempdir = tempfile.gettempdir() # get the current temporary directory
        #print(tempdir)
        #fileNm = os.path.basename(fname)
        # tempfilepath = os.path.join(tempdir,fname.rstrip(".fcstd").rstrip(".FCStd") + u'_cp.stp')
        tempfilepath = os.path.join(tempdir,fileNm + u'_cp.stp')
        print(tempfilepath)
        sel=FreeCADGui.Selection.getSelection()
        if len (sel) == 1:
            __objs__=[]
            __objs__.append(sel[0])
            import ImportGui
            stop
            ImportGui.export(__objs__,tempfilepath)
            del __objs__
            # docG.getObject(sel[0].Name).Visibility = False
            ImportGui.insert(tempfilepath,doc.Name)
            FreeCADGui.SendMsgToActiveView("ViewFit")
        else:
            FreeCAD.Console.PrintError('Select only one object')      
    else:
        FreeCAD.Console.PrintError('Select only one object')
## 
Example #14
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def step(self,now):
		say("Bounder step!" + str(now))
		if now<=self.obj2.start or now>self.obj2.end:
			pass
		else:
			gob=FreeCAD.ActiveDocument.getObject(self.obj2.obj.Name)
			pm=gob.Placement.Base
			x, y, z = pm.x, pm.y, pm.z

			if self.obj2.x:
				if self.obj2.xmin>x:
					x=self.obj2.xmin
					say("xmin")
				if self.obj2.xmax<x:
					x=self.obj2.xmax
					say("xmax")

			if self.obj2.y:
				if self.obj2.ymin>y:
					y=self.obj2.ymin
				if self.obj2.ymax<y:
					y=self.obj2.ymax

			if self.obj2.z:
				if self.obj2.zmin>z:
					z=self.obj2.zmin
				if self.obj2.zmax<z:
					z=self.obj2.zmax

			gob.Placement.Base=FreeCAD.Vector(x,y,z)
			pm=gob.Placement.Base
			FreeCADGui.updateGui() 
Example #15
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def getObject(self,name):
		if  isinstance(name,str):
#			obj=FreeCAD.ActiveDocument.getObject(name)
			objl=App.ActiveDocument.getObjectsByLabel(name)
			obj=objl[0]
			sayd('obj found')
		else:
			obj=name
		sayd(obj)
		return obj 
Example #16
Source File: pipeFeatures.py    From flamingo with GNU Lesser General Public License v3.0 5 votes vote down vote up
def claimChildren(self):
    children=[FreeCAD.ActiveDocument.getObject(name) for name in self.Object.Tubes+self.Object.Curves]
    return children 
Example #17
Source File: pipeFeatures.py    From flamingo with GNU Lesser General Public License v3.0 5 votes vote down vote up
def nearestPort (self,point=None):
    '''
    nearestPort (point=None)
      Returns the Port nearest to  point 
      or to the selected geometry.
      (<portNr>, <portPos>, <portDir>)
    '''
    obj=FreeCAD.ActiveDocument.getObject(self.Name)
    if not point and FreeCADGui.ActiveDocument:
      try:
        selex=FreeCADGui.Selection.getSelectionEx()
        target=selex[0].Object
        so=selex[0].SubObjects[0]
      except:
        FreeCAD.Console.PrintError('No geometry selected\n')
        return None
      if type(so)==Part.Vertex: point=so.Point
      else: point=so.CenterOfMass
    if point:
      pos=pipeCmd.portsPos(obj)[0]; Z=pipeCmd.portsDir(obj)[0]
      i=nearest=0
      if len(obj.Ports)>1:
        for p in pipeCmd.portsPos(obj)[1:] :
          i+=1
          if (p-point).Length<(pos-point).Length:
            pos=p
            Z=pipeCmd.portsDir(obj)[i]
            nearest=i
      return nearest, pos, Z 
Example #18
Source File: Commands.py    From NodeEditor with MIT License 5 votes vote down vote up
def T1():

    for n in FreeCAD.PF.graphManager.get().getAllNodes():
        yid="ID_"+str(n.uid)
        yid=yid.replace('-','_')
        a=FreeCAD.ActiveDocument.getObject(yid)
        if a != None:
            FreeCAD.ActiveDocument.removeObject(yid)
            n._preview = True 
Example #19
Source File: Commands.py    From NodeEditor with MIT License 5 votes vote down vote up
def createsomeparts():
    ''' default box,cone and sphere for testing'''

    box=FreeCAD.ActiveDocument.addObject("Part::Box","Box")
    box2=FreeCAD.ActiveDocument.addObject("Part::Cone","Cone")
    sphere=FreeCAD.ActiveDocument.addObject("Part::Sphere","Sphere")
    FreeCAD.activeDocument().recompute() 
Example #20
Source File: NiCrInit.py    From NiCr with GNU General Public License v2.0 5 votes vote down vote up
def IsActive(self):
        try:
            a = FreeCAD.ActiveDocument.FinalPath
            return True
        except:
            return False 
Example #21
Source File: Commands.py    From NodeEditor with MIT License 5 votes vote down vote up
def view3DRefandLOD():

    FreeCAD.ActiveDocument.addObject("Part::Cone","Cone")
    FreeCAD.ActiveDocument.addObject("Part::Box","Box")
    FreeCAD.activeDocument().recompute()

    FreeCADGui.Selection.clearSelection()
    if 10:
        FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Box,['Face1'])
        FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Box,['Face2'])
        FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Box,['Face3'])
        FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Box,['Face4'])
    else:
        FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Cone,['Face1'])

    instance=pfwrap.getInstance()
    clearGraph()
    gg=pfwrap.getGraphManager().getAllGraphs()[0]

    rib5 = pfwrap.createNode('PyFlowFreeCAD',"FreeCAD_view3D","view3D")
    rib5.setPosition(100,0)
    gg.addNode(rib5)

    t2 = pfwrap.createNode('PyFlowFreeCAD',"FreeCAD_Ref","Ref_Box",b="das ist B")
    t2.compute()
    gg.addNode(t2)

    t2 = pfwrap.createNode('PyFlowFreeCAD',"FreeCAD_LOD","myLOD")
    rib5.setPosition(100,200)
    t2.compute()
    gg.addNode(t2)

    #connection = pfwrap.connect(t2,'Shape',rib5,'Shape')
    refresh_gui() 
Example #22
Source File: Commands.py    From NodeEditor with MIT License 5 votes vote down vote up
def saveAll():
    saveGraph()
    FreeCAD.ActiveDocument.saveAs(u"/home/thomas/{}.FCStd".format(fn))
    pass 
Example #23
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def step(self,now):
		pfn=self.obj2.pictures%now
		if os.path.exists(pfn):
			self.obj2.rectangle.ViewObject.TextureImage = pfn
			say("image: " + pfn)
		tx=FreeCADGui.activeDocument().activeView()
		rx=tx.getCameraOrientation()
		r2=FreeCAD.Rotation(FreeCAD.Vector(1,0,0),180)
		r3=rx.multiply(r2)
		self.obj2.rectangle.Placement.Rotation=r3
		FreeCAD.ActiveDocument.recompute()

#---------------------------------------------------------------------------------------------------------- 
Example #24
Source File: Commands.py    From NodeEditor with MIT License 5 votes vote down vote up
def loadAll():
    showPyFlow()
    try:
        FreeCAD.getDocument(fn)
    except:
        FreeCAD.open(u"/home/thomas/{}.FCStd".format(fn))

    FreeCAD.setActiveDocument(fn)
    FreeCAD.ActiveDocument=FreeCAD.getDocument(fn)
    FreeCADGui.ActiveDocument=FreeCADGui.getDocument(fn)
    loadGraph()
    pass 
Example #25
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def step(self,now):
		k=self.obj2.text
		fne=self.obj2.textFiles
		fn=fne%now
		if os.path.exists(fn):
			say("textfile: " + fn)
			data = [line.strip() for line in open(fn, 'r')]
			sayd(data)
			self.obj2.text=data
		k=self.obj2.text
		#--------------------------------
		kf= "%04.f"%now
		if self.obj2.showFrame:
			k.append("Frame: " + kf)
		lt = localtime()
		if self.obj2.showDate:
			tz=strftime("%d.%m.%Y", lt)
			ts=strftime("%H:%M:%S", lt)
			k.append(tz)
			k.append(ts)
		if self.obj2.showFile:
			k.append("File: "+ os.path.basename(FreeCAD.ActiveDocument.FileName))
			k.append("Author: "+ FreeCAD.ActiveDocument.LastModifiedBy)
		self.obj2.textObj.LabelText=k
		FreeCAD.ActiveDocument.recompute()

#----------------------
# Mover
#---------------------- 
Example #26
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def createMover(name='My_Mover'):
	obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
	obj.addProperty("App::PropertyInteger","start","Base","start").start=0
	obj.addProperty("App::PropertyInteger","end","Base","end").end=10
	obj.addProperty("App::PropertyInteger","duration","Base","end").duration=10
	obj.addProperty("App::PropertyEnumeration","ModeMotion","Motion","Modus").ModeMotion=['Vector','DLine','DWire','Shape.Edge','Path']
	obj.addProperty("App::PropertyVector","vectorMotion","Motion","motionVector").vectorMotion=FreeCAD.Vector(100,0,0)
	obj.addProperty("App::PropertyLink","sourceMotion","Motion","source objectfor the motion vector")
	obj.addProperty("App::PropertyInteger","indexMotion","Motion","position on the source").indexMotion=1
	obj.addProperty("App::PropertyBool","reverseMotion","Motion","recvers the direction fo the vector").reverseMotion=False
	obj.addProperty("App::PropertyPlacement","initPlaceMotion","Object","initPlace")
	obj.addProperty("App::PropertyLink","obj2","Object","moving object ")
	_Mover(obj)
	_ViewProviderMover(obj.ViewObject)
	return obj 
Example #27
Source File: InitGui.py    From NodeEditor with MIT License 5 votes vote down vote up
def IsActive(self):
        if Gui.ActiveDocument:
            return True
        else:
            return False 
Example #28
Source File: InitGui.py    From NodeEditor with MIT License 5 votes vote down vote up
def ondocument():
    '''if a document is active'''
    return FreeCADGui.ActiveDocument is not None 
Example #29
Source File: EAInit.py    From ExplodedAssembly with GNU General Public License v2.0 5 votes vote down vote up
def IsActive(self):
        if FreeCADGui.ActiveDocument:
            if not(FreeCAD.ActiveDocument.ExplodedAssembly.InAnimation):
                return True

        else:
            return False 
Example #30
Source File: Animation.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def step(self,now):
		App=FreeCAD
		say("step " +str(now))
		s=self.obj2.ext.Spine
		ss=s[0]
		kk=s[1]
		if now==self.obj2.start:
			kk=[]
			steps=20
			steps=self.obj2.duration
			l=ss.Shape.copy().discretize(steps)
			f=Part.makePolygon(l)
			f1=Part.show(f)
			ss=FreeCAD.ActiveDocument.Objects[-1]
		kk.append("Edge"+str(now+1-self.obj2.start))
		if now<self.obj2.start:
			kk=["Edge1"]
			self.obj2.ext.ViewObject.Visibility=False
		else: 
			self.obj2.ext.ViewObject.Visibility=True
		self.obj2.ext.Spine=(ss,kk)
		FreeCAD.ActiveDocument.recompute()
		FreeCADGui.updateGui() 

#----------------------------------------------------------------------------------------------------------
#  Movie Screen
#----------------------------------------------------------------------------------------------------------