Template:ExampleCode

From FreeCAD Documentation
##exampleCode##
{{{1}}}  

  • Use this template when you want to display the example code :

{{ExampleCode|example=
import FreeCAD, Draft
Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(2,0,0))
}}

Result:

##exampleCode##
import FreeCAD, Draft
Draft.makeLine(FreeCAD.Vector(0,0,0),FreeCAD.Vector(2,0,0)) 


REMARK:

  1. This template {{ExampleCode|example=xx}} is different and is created for differentiate the code example and the principal code of the macro for use with the addons_installer.FCMacro for download the first read code
  2. The tag ##exampleCode## is generate automatically and used by the system not delete or modify the position of this tag in the original template
  3. Since a content that includes an equals sign (=) is interpreted as a variable, you must specify the code parameter explicitly to avoid issues (as in the above example)
  4. If the macro code content the characters : "|" (Vertical bar) or "{ }" (Closing brace or Opening brace) not use this template (the macro code is dislocated an erroneous), use the HTML code <pre> ... </pre>