Files
create/src/Mod/Draft/draftmake
alafr 8329a181c9 Draft : fix Label Justification (#13444)
Draft Label ViewObject.Justification property was overriden by Object.StraightDistance property. The Justification in the 3D view was reset after recompute. This commit fixes the problem by setting Object.StraightDistance automatically when ViewObject.Justification is changed and vice versa. Also fixes the frame position when Justification is Center.
2025-06-24 10:45:46 +02:00
..
2023-01-22 20:26:40 +01:00
2023-01-22 20:26:40 +01:00

2020 May

These modules contain the basic functions to create custom "scripted objects" defined within the workbench.

Each scripted object has a "make function" like make_rectangle, a proxy class like Rectangle, and a viewprovider class like ViewProviderRectangle. Each make function should import the two corresponding classes in order to create a new object with the correct data and visual properties for that object. These classes should be defined in the modules in draftobjects/ and draftviewproviders/.

The make functions can be used in both graphical and non-graphical modes (terminal only); in the latter case the viewprovider is not used. The functions are also used internally by the graphical "GuiCommands" (buttons, menu actions) defined in the modules in draftguitools/ and drafttaskpanels/.

These make functions were previously defined in the Draft.py module, which was very large. Now Draft.py just loads the individual modules in order to provide these functions under the Draft namespace.

import Draft

new_obj1 = Draft.make_rectangle(...)
new_obj2 = Draft.make_circle(...)
new_obj3 = Draft.make_line(...)

The functions in the Draft namespace are considered to be the public application programming interface (API) of the workbench, and should be usable in scripts, macros, and other workbenches.

For more information see the thread: [Discussion] Splitting Draft tools into their own modules