TechDrawGui API/fr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{VeryImportantMessage|(November 2018) This information may be incomplete and outdated. For the latest API, see the [https://www.freecadweb.org/api autogenerated API documentation].}}
{{VeryImportantMessage|(Novembre 2018) Ces informations peuvent être incomplètes et obsolètes. Pour la dernière API, consultez [https://www.freecadweb.org/api autogenerated API documentation].}}
These functions are part of the [[TechDraw Workbench|TechDraw Workbench]] and can be used in [[macros|macros]] and from the [[Python|Python]] console once the {{incode|TechDrawGui}} module has been imported.
Ces fonctions font partie de l'[[TechDraw Workbench/fr|atelier TechDraw]] et peuvent être utilisées dans [[mMcros/fr|macros]] et à partir de la console [[Python/fr|Python]] une fois que le module {{incode|TechDrawGui}} a été importé.


See the [[TechDraw API|TechDraw API]] for more functions.
Voir [[TechDraw API/fr|TechDraw API]] pour plus de fonctions.


Exemple:
Example:
{{Code|code=
{{Code|code=
import FreeCAD
import FreeCAD
Line 19: Line 19:
}}
}}


{{APIFunction|exportPageAsPdf|pageObject, filePath|save a copy of pageObject in PDF format to location filePath|none}}
{{APIFunction|exportPageAsPdf|pageObject, filePath|enregistre une copie de pageObject au format PDF à l'emplacement filePath|rien}}
{{APIFunction|exportPageAsSvg|pageObject, filePath|save a copy of pageObject in SVG format to location filePath|none}}
{{APIFunction|exportPageAsSvg|pageObject, filePath|enregistre une copie de pageObject au format SVG à l'emplacement filePath|rien}}
{{APIFunction|copyActiveViewToSvgFile|document, filePath, (options)|save a copy of the active view for "document" to file "filePath"|double (estimated scale)}}
{{APIFunction|copyActiveViewToSvgFile|document, filePath, (options)|enregistre une copie de la vue active pour "document" dans le fichier "filePath"|double (échelle estimée)}}
Options:
Options:
* width - float - width of generated svg in mm
* width - float - largeur du svg généré en mm
* height - float - height of generated svg in mm
* height - float - hauteur du svg généré en mm
* paintBackground - bool - paint/do not paint background
* paintBackground - bool - colore ou pas le fond
* backgroundColor - tuple - (r,g,b,a)
* backgroundColor - tuple - (r,g,b,a)
* lineWidth - float - weight of lines
* lineWidth - float - largeur des lignes
* border - float - empty space around image
* border - float - espace vide autour de l'image
* mode - int - rendering mode (AS_IS, WIREFRAME, POINTS, WIREFRAME_OVERLAY, HIDDEN_LINE, BOUNDING_BOX)
* mode - int - mode de rendu (AS_IS, WIREFRAME, POINTS, WIREFRAME_OVERLAY, HIDDEN_LINE, BOUNDING_BOX)
<br/>
<!--T:6-->
{{APIFunction|addQGIToView|view, QGraphicsItem|ajoute un QGraphicsItem (créé à l'aide de PySide) à une vue|rien}}
{{TechDraw Tools navi}}

<!--T:4-->
[[Category:API]]


[[Category:Poweruser Documentation]]


{{TechDraw Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
[[Category:API{{#translation:}}]]
[[Category:Poweruser Documentation{{#translation:}}]]
{{clear}}
{{clear}}

Latest revision as of 21:02, 16 January 2024

(Novembre 2018) Ces informations peuvent être incomplètes et obsolètes. Pour la dernière API, consultez autogenerated API documentation.

Ces fonctions font partie de l'atelier TechDraw et peuvent être utilisées dans macros et à partir de la console Python une fois que le module TechDrawGui a été importé.

Voir TechDraw API pour plus de fonctions.

Exemple:

import FreeCAD
import TechDrawGui

p = FreeCAD.ActiveDocument.Page

f = "/home/localuser/myPdfDirectory/savePage.pdf"
TechDrawGui.exportPageAsPdf(p, f)

f = "/home/localuser/mySvgDirectory/savePage.svg"
TechDrawGui.exportPageAsSvg(p, f)
exportPageAsPdf(pageObject, filePath)

Description: enregistre une copie de pageObject au format PDF à l'emplacement filePath

Returns: rien

exportPageAsSvg(pageObject, filePath)

Description: enregistre une copie de pageObject au format SVG à l'emplacement filePath

Returns: rien

copyActiveViewToSvgFile(document, filePath, (options))

Description: enregistre une copie de la vue active pour "document" dans le fichier "filePath"

Returns: double (échelle estimée)

Options:

  • width - float - largeur du svg généré en mm
  • height - float - hauteur du svg généré en mm
  • paintBackground - bool - colore ou pas le fond
  • backgroundColor - tuple - (r,g,b,a)
  • lineWidth - float - largeur des lignes
  • border - float - espace vide autour de l'image
  • mode - int - mode de rendu (AS_IS, WIREFRAME, POINTS, WIREFRAME_OVERLAY, HIDDEN_LINE, BOUNDING_BOX)


addQGIToView(view, QGraphicsItem)

Description: ajoute un QGraphicsItem (créé à l'aide de PySide) à une vue

Returns: rien