GuiCommand model: Difference between revisions

From FreeCAD Documentation
(Use the {{VeryImportantTemplate}} instead of the {{Message}} template)
m (png to svg)
(26 intermediate revisions by 5 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:15-->
<!--T:15-->
{{VeryImportantMessage|This page shows a model of a recommended GuiCommand page. Under the [[#Selectable block|Selectable block]] section below you will find the same content easily selectable for pasting in a new page.}}
{{VeryImportantMessage|This page shows a model to document a [[Gui Command|Gui Command]]. Under the [[#Selectable block|Selectable block]] section below you will find the same content easily selectable for pasting in a new page.}}


<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Base ExampleCommandModel
|Name=Base ExampleCommandModel
|Icon=<!--filename of icon with extension (e.g. svg, png) if not the same name as command / delete row if unused-->
|Icon=<!--filename of icon with extension (e.g. svg, png) if not the same name as command; delete this row if not used-->
|MenuLocation=Menu → Submenu → Command
|MenuLocation=Menu → Submenu → Command
|Workbenches=[[Workbench Name|Workbench]]
|Workbenches=[[Workbench Name|Workbench]]
|Shortcut=<!--delete this row if not used-->
|Shortcut={{KEY|F}} {{KEY|C}} <!--delete this row if not used-->
|SeeAlso=<!--add links to similar commands, delete this row if not used-->
|SeeAlso=<!--add links to similar commands; delete this row if not used-->
|Version=0.17
|Version=0.17
}}
}}


==Description== <!--T:2-->
==Description== <!--T:2-->

<!--T:24-->
While the page is under construction, add the [[Template:UnfinishedDocu]] template at the top of the page by simply typing: '''<nowiki>{{UnfinishedDocu}}</nowiki>'''


<!--T:13-->
<!--T:13-->
Insert here a short description of what the command does.
Insert here a short description of what the command does.

<!--T:29-->
Remember to use [[Template:Version]], [[Template:VersionMinus]], [[Template:VersionPlus]] and [[Template:Obsolete]] when applicable.

<!--T:30-->
For example: The feature to utilize {{incode|App::Link}} {{Version|0.19}} allows linking between sub-assemblies etc...


<!--T:16-->
<!--T:16-->
Line 26: Line 35:
<translate>
<translate>
<!--T:17-->
<!--T:17-->
''Optional: add a caption in italics below the image.''
{{Caption|Optional: add a caption below the image to explain what the tool is doing.}}

<!--T:25-->
Closing and opening translate tags should surround images, and other fixed elements, if they don't need to be translated. The caption should always be translated.


==How to use== <!--T:3-->
==Usage== <!--T:3-->


<!--T:4-->
<!--T:4-->
# There are several ways to invoke the command:
# Press the {{KEY|[[File:Std Close.png|24px]] '''Command name'''}} button.
#* The {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}} button from the toolbar (''Editor note:'' Using the [[Template:Button]] template, it is necessary to link to command as shown in this example)
# Detailed steps as needed.
#* Using the {{MenuCommand|Menu → Submenu → Command}} from the top menu. (''Editor note:'' This uses the [[Template:MenuCommand]] wiki template)
# Set options and press {{KEY|OK}}.
#* Use the keyboard shortcut {{KEY|F}} then {{KEY|C}} or {{KEY|Ctrl}} + {{KEY|Z}} (''Editor note:'' This uses the [[Template:KEY]] wiki template)
#* (Optional) RMB (Right Mouse Button) context menu: {{MenuCommand|RMB → {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}}}}
# Detailed steps as needed. Some steps may need {{KEY|Keyboard}} presses while others may require using the mouse to click on a {{Button|Button}}
# Other commands may need to be referenced/used. Consider linking to their wiki pages along with their icons {{Button|[[Image:Draft_Line.svg|16px]] [[Draft Line|Draft Line]]}} or {{Button|[[Image:PartDesign_Pad.svg|16px]] [[PartDesign Pad|PartDesign Pad]]}}
# Set options and press {{Button|OK}}.


==Options== <!--T:5-->
==Options== <!--T:5-->


<!--T:18-->
<!--T:18-->
* List the command options here. Check out two examples, [[Draft Line]] and [[PartDesign Pad]].
* List the command options here. Check out two examples, {{Button|[[Image:Draft_Line.svg|16px]] [[Draft Line|Draft Line]]}} and {{Button|[[Image:PartDesign_Pad.svg|16px]] [[PartDesign Pad|PartDesign Pad]]}}.


==Properties== <!--T:6-->
==Properties== <!--T:6-->
Line 56: Line 73:


==Scripting== <!--T:8-->
==Scripting== <!--T:8-->

<!--T:26-->
{{Emphasis|See also:}} [[:Category:API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:9-->
<!--T:9-->
The ExampleCommandModel tool can be used in [[macros]] and from the python console by using the following function:
The ExampleCommandModel tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

</translate>
</translate>
{{Code|code=
'''makeExampleCommandModel(Data, Data)'''
Object = makeExampleCommandModel(Data1, Data2)
}}
<translate>
<translate>

<!--T:10-->
<!--T:10-->
* Creates a CommandModel using Data.
* Creates an {{incode|Object}} using {{incode|Data1}} and {{incode|Data2}}.
* Returns the newly created object.


<!--T:11-->
<!--T:11-->
Example:
Example:

</translate>
</translate>
{{Code|code=
import FreeCAD, Base
import FreeCAD, Base
Base.makeExampleCommandModel(FreeCAD.Data,FreeCAD.Data)

Model = Base.makeExampleCommandModel(FreeCAD.Data1, FreeCAD.Data2)
}}
<translate>
<translate>


Line 81: Line 108:
</translate>
</translate>
{{clear}}
{{clear}}
<translate>


==Selectable block==
==Selectable block== <!--T:28-->


</translate>
<nowiki>
<nowiki>
{{UnfinishedDocu}}
<translate>

{{GuiCommand
{{GuiCommand
|Name=Base ExampleCommandModel
|Name=Base ExampleCommandModel
|Icon=<!--filename of icon with extension (e.g. svg, png) if not the same name as command / delete row if unused-->
|Icon=<!--filename of icon with extension (e.g. svg, png) if not the same name as command; delete this row if not used-->
|MenuLocation=Menu → Submenu → Command
|MenuLocation=Menu → Submenu → Command
|Workbenches=[[Workbench Name|Workbench]]
|Workbenches=[[Workbench Name|Workbench]]
|Shortcut=<!--delete this row if not used-->
|Shortcut={{KEY|F}} {{KEY|C}} <!--delete this row if not used-->
|SeeAlso=<!--add links to similar commands, delete this row if not used-->
|SeeAlso=<!--add links to similar commands; delete this row if not used-->
|Version=0.17
|Version=0.17
}}
}}


==Description==
==Description==

While the page is under construction, add the {{UnfinishedDocu}} template at the top of the page.


Insert here a short description of what the command does.
Insert here a short description of what the command does.


</translate>
</translate>
[[File:Draft_Line_example.jpg|none|400px]]
[[Image:Draft_Line_example.jpg|none|400px]]
<translate>
<translate>
''Optional: add a caption in italics.''


{{Caption|Optional: add a caption below the image to explain what the tool is doing.}}
==How to use==

Closing and opening translate tags should surround images, and other fixed elements, if they don't need to be translated. The caption should always be translated.

==Usage==


# There are several ways to invoke the command:
# Press the {{KEY|[[File:Std Close.png|24px]] '''Command name'''}} button.
#* The {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}} button from the toolbar (''Editor note:'' Using the [[Template:Button]] template, it is necessary to link to command as shown in this example)
# Detailed steps as needed.
#* Using the {{MenuCommand|Menu → Submenu → Command}} from the top menu. (''Editor note:'' This uses the [[Template:MenuCommand]] wiki template)
# Set options and press {{KEY|OK}}.
#* Use the keyboard shortcut {{KEY|F}} then {{KEY|C}} or {{KEY|Ctrl}} + {{KEY|Z}} (''Editor note:'' This uses the [[Template:KEY]] wiki template)
#* (Optional) RMB (Right Mouse Button) context menu: {{MenuCommand|RMB → {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}}}}
# Detailed steps as needed. Some steps may need {{KEY|Keyboard}} presses while others may require using the mouse to click on a {{Button|Button}}
# Other commands may need to be referenced/used. Consider linking to their wiki pages along with their icons {{Button|[[Image:Draft_Line.svg|16px]] [[Draft Line|Draft Line]]}} or {{Button|[[Image:PartDesign_Pad.svg|16px]] [[PartDesign Pad|PartDesign Pad]]}}
# Set options and press {{Button|OK}}.


==Options==
==Options==
Line 129: Line 171:


==Scripting==
==Scripting==
{{Emphasis|See also:}} [[:Category:API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].

The ExampleCommandModel tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:


The ExampleCommandModel tool can be used in [[macros]] and from the python console by using the following function:
</translate>
</translate>
{{Code|code=
'''makeExampleCommandModel(Data, Data)'''
Object = makeExampleCommandModel(Data1, Data2)
}}
<translate>
<translate>

* Creates a CommandModel using Data.
* Creates an {{incode|Object}} using {{incode|Data1}} and {{incode|Data2}}.
* Returns the newly created object.


Example:
Example:

</translate>
</translate>
{{Code|code=
import FreeCAD, Base
import FreeCAD, Base
Base.makeExampleCommandModel(FreeCAD.Data,FreeCAD.Data)

Model = Base.makeExampleCommandModel(FreeCAD.Data1, FreeCAD.Data2)
}}
<translate>
<translate>


Line 150: Line 200:


Optional
Optional

</translate>

</nowiki>
</nowiki>
<translate>

<!--T:27-->
[[Category:Wiki:Example]]

</translate>

Revision as of 00:33, 24 February 2020

This page shows a model to document a Gui Command. Under the Selectable block section below you will find the same content easily selectable for pasting in a new page.

Base ExampleCommandModel

Menu location
Menu → Submenu → Command
Workbenches
Workbench
Default shortcut
F C
Introduced in version
0.17
See also
None

Description

While the page is under construction, add the Template:UnfinishedDocu template at the top of the page by simply typing: {{UnfinishedDocu}}

Insert here a short description of what the command does.

Remember to use Template:Version, Template:VersionMinus, Template:VersionPlus and Template:Obsolete when applicable.

For example: The feature to utilize App::Link introduced in version 0.19 allows linking between sub-assemblies etc...

Add an image if possible, and please follow the guidelines in WikiPages#Graphics. Example taken from Draft Line:

Optional: add a caption below the image to explain what the tool is doing.

Closing and opening translate tags should surround images, and other fixed elements, if they don't need to be translated. The caption should always be translated.

Usage

  1. There are several ways to invoke the command:
  2. Detailed steps as needed. Some steps may need Keyboard presses while others may require using the mouse to click on a Button
  3. Other commands may need to be referenced/used. Consider linking to their wiki pages along with their icons Draft Line or PartDesign Pad
  4. Set options and press OK.

Options

Properties

Data

  • DataPropertyName1: Description of the property

View

  • ViewPropertyName2: Description of the property

Example

Optional

Scripting

See also: Category:API and FreeCAD Scripting Basics.

The ExampleCommandModel tool can be used in macros and from the Python console by using the following function:

Object = makeExampleCommandModel(Data1, Data2)
  • Creates an Object using Data1 and Data2.

Example:

import FreeCAD, Base

Model = Base.makeExampleCommandModel(FreeCAD.Data1, FreeCAD.Data2)

Limitations

  • Optional, use bullet list if multiple items

Other

Optional

Selectable block

{{UnfinishedDocu}}
<translate>

{{GuiCommand
|Name=Base ExampleCommandModel
|Icon=<!--filename of icon with extension (e.g. svg, png) if not the same name as command; delete this row if not used-->
|MenuLocation=Menu → Submenu → Command
|Workbenches=[[Workbench Name|Workbench]]
|Shortcut={{KEY|F}} {{KEY|C}} <!--delete this row if not used-->
|SeeAlso=<!--add links to similar commands; delete this row if not used-->
|Version=0.17
}}

==Description==

While the page is under construction, add the {{UnfinishedDocu}} template at the top of the page.

Insert here a short description of what the command does.

</translate>
[[Image:Draft_Line_example.jpg|none|400px]]
<translate>

{{Caption|Optional: add a caption below the image to explain what the tool is doing.}}

Closing and opening translate tags should surround images, and other fixed elements, if they don't need to be translated. The caption should always be translated.

==Usage==

# There are several ways to invoke the command: 
#* The {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}} button from the toolbar (''Editor note:'' Using the [[Template:Button]] template, it is necessary to link to command as shown in this example)
#* Using the {{MenuCommand|Menu → Submenu → Command}} from the top menu. (''Editor note:'' This uses the [[Template:MenuCommand]] wiki template)
#* Use the keyboard shortcut {{KEY|F}} then {{KEY|C}} or {{KEY|Ctrl}} + {{KEY|Z}} (''Editor note:'' This uses the [[Template:KEY]] wiki template)
#* (Optional) RMB (Right Mouse Button) context menu: {{MenuCommand|RMB → {{Button|[[Image:Std Close.png|16px]] [[GuiCommand model|Command name]]}}}}
# Detailed steps as needed. Some steps may need {{KEY|Keyboard}} presses while others may require using the mouse to click on a {{Button|Button}} 
# Other commands may need to be referenced/used. Consider linking to their wiki pages along with their icons {{Button|[[Image:Draft_Line.svg|16px]] [[Draft Line|Draft Line]]}} or {{Button|[[Image:PartDesign_Pad.svg|16px]] [[PartDesign Pad|PartDesign Pad]]}}
# Set options and press {{Button|OK}}.

==Options==

* List the command options here.

==Properties==

===Data===

* {{PropertyData|PropertyName1}}: Description of the property

===View===

* {{PropertyView|PropertyName2}}: Description of the property

==Example==

Optional

==Scripting==
{{Emphasis|See also:}} [[:Category:API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].

The ExampleCommandModel tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

</translate>
{{Code|code=
Object = makeExampleCommandModel(Data1, Data2)
}}
<translate>

* Creates an {{incode|Object}} using {{incode|Data1}} and {{incode|Data2}}.

Example:

</translate>
{{Code|code=
import FreeCAD, Base

Model = Base.makeExampleCommandModel(FreeCAD.Data1, FreeCAD.Data2)
}}
<translate>

==Limitations==

* Optional, use bullet list if multiple items

==Other==

Optional

</translate>