-
Notifications
You must be signed in to change notification settings - Fork 18
config.xml Part Selector
daniel-flassig edited this page Jun 24, 2020
·
10 revisions
A part selector extension creates a button in the pytha part selection user interface. The extension may add to or remove parts from the selection.
Declaration of a part-selector extension in the config.xml:
<extension type="part-selector">
<entry-point>change_selection</entry-point>
<caption>Button Caption</caption>
<description>A short description what this button does.</description>
</extension>The following information can be supplied:
-
entry-point- (Mandatory) Name of the lua function that is invoked when the user presses the button. -
caption- (Mandatory) The text that is displayed on the button. This text is translatable in the .xlif file. -
description- A short descriptive text that is displayed when the user hovers over the button with the mouse. This text is translatable in the .xlif file.
The entry-point is invoked with one argument
change_selection(selection)| Parameter | Type | Description |
|---|---|---|
selection |
table |
A table of element handles of the selected parts. |
To modify the selection, change the content of the selection table.
There is no return value.
A useful pattern is to enumerate all parts:
for part in pytha.enumerate_parts() do
if ... then -- add some condition on the part here
table.insert(selection, part)
end
endconfig.xml, Function Extension, Edit Extension, Attribute Extension, Element Handles, Anatomy of a Lua Api Plugin, Localization and Translation