parameters: (p)
docstring: circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL
docstring_summary: circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL
docstring_tokens: circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL
function: def p_circle_action(p) :
      'circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL'
      if printverbose: print("Circle : "+str(p[3]))
      r = float(p[3]['r'])
      # Avoid zero radius
      if r == 0 : r = 0.00001
      n = int(p[3]['$fn'])
      fnmax = FreeCAD.ParamGet(\
          "User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
          GetInt('useMaxFN',16)
      # Alter Max polygon to control if polygons are circles or polygons
      # in the modules preferences
      import Draft
      if n == 0 or fnmax != 0 and n >= fnmax:
          mycircle = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",'circle')
          Draft._Circle(mycircle)
          mycircle.Radius = r
          mycircle.MakeFace = True
          mycircle = Draft.makeCircle(r,face=True) # would call doc.recompute
          FreeCAD.ActiveDocument.recompute()
          #mycircle = doc.addObject('Part::Circle',p[1]) #would not create a face
          #mycircle.Radius = r
      else :
          #mycircle = Draft.makePolygon(n,r) # would call doc.recompute
          mycircle = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",'polygon')
          Draft._Polygon(mycircle)
          mycircle.FacesNumber = n
          mycircle.Radius = r
          mycircle.DrawMode = "inscribed"
          mycircle.MakeFace = True
      if gui:
          Draft._ViewProviderDraft(mycircle.ViewObject)
      if printverbose: print("Push Circle")
      p[0] = [mycircle]
function_tokens: def p_circle_action ( p ) : if printverbose : print ( "Circle : " + str ( p [ 3 ] ) ) r = float ( p [ 3 ] [ 'r' ] ) # Avoid zero radius if r == 0 : r = 0.00001 n = int ( p [ 3 ] [ '$fn' ] ) fnmax = FreeCAD . ParamGet ( "User parameter:BaseApp/Preferences/Mod/OpenSCAD" ) . GetInt ( 'useMaxFN' , 16 ) # Alter Max polygon to control if polygons are circles or polygons # in the modules preferences import Draft if n == 0 or fnmax != 0 and n >= fnmax : mycircle = FreeCAD . ActiveDocument . addObject ( "Part::Part2DObjectPython" , 'circle' ) Draft . _Circle ( mycircle ) mycircle . Radius = r mycircle . MakeFace = True mycircle = Draft . makeCircle ( r , face = True ) # would call doc.recompute FreeCAD . ActiveDocument . recompute ( ) #mycircle = doc.addObject('Part::Circle',p[1]) #would not create a face #mycircle.Radius = r else : #mycircle = Draft.makePolygon(n,r) # would call doc.recompute mycircle = FreeCAD . ActiveDocument . addObject ( "Part::Part2DObjectPython" , 'polygon' ) Draft . _Polygon ( mycircle ) mycircle . FacesNumber = n mycircle . Radius = r mycircle . DrawMode = "inscribed" mycircle . MakeFace = True if gui : Draft . _ViewProviderDraft ( mycircle . ViewObject ) if printverbose : print ( "Push Circle" ) p [ 0 ] = [ mycircle ]