mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-08 04:44:13 +02:00
Add an option to export a symbol's texts as DXF block attributes (#1339)
With symbols as blocks and the new "DXF : textes des symboles en attributs" option (--dxf-attributes on the command line), a symbol's own texts (its label, function, comment...) are attributes of its INSERT instead of loose texts, so a CAD program moves them with the symbol and can list or edit them. Each is written exactly where, and as, the text was. A text showing an information field is tagged with its name (LABEL, FUNCTION...), a typed text TEXT1, TEXT2...; a text's second line gets _2. The block defines each tag once, placed where the first symbol has it. Its own option, off by default, because LibreCAD (2.2.1.5) does not show attributes: the labels would vanish there. AutoCAD shows them. The text geometry moves into textLines(), shared with the text loop, so the attributes and the plain texts cannot drift apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,6 +67,7 @@ ExportProperties ExportPropertiesWidget::exportProperties() const
|
||||
export_properties.draw_bg_transparent = draw_bg_transparent -> isChecked();
|
||||
export_properties.draw_colored_conductors = draw_colored_conductors -> isChecked();
|
||||
export_properties.dxf_blocks = dxf_blocks -> isChecked();
|
||||
export_properties.dxf_attributes = dxf_attributes -> isChecked();
|
||||
export_properties.exported_area = export_border -> isChecked() ? QET::BorderArea : QET::ElementsArea;
|
||||
|
||||
return(export_properties);
|
||||
@@ -91,6 +92,8 @@ void ExportPropertiesWidget::setExportProperties(const ExportProperties &export_
|
||||
draw_bg_transparent -> setChecked(export_properties.draw_bg_transparent);
|
||||
draw_colored_conductors -> setChecked(export_properties.draw_colored_conductors);
|
||||
dxf_blocks -> setChecked(export_properties.dxf_blocks);
|
||||
dxf_attributes -> setChecked(export_properties.dxf_attributes);
|
||||
dxf_attributes -> setEnabled(export_properties.dxf_blocks);
|
||||
|
||||
if (export_properties.exported_area == QET::BorderArea) {
|
||||
export_border -> setChecked(true);
|
||||
@@ -226,6 +229,12 @@ void ExportPropertiesWidget::build()
|
||||
dxf_blocks = new QCheckBox(tr("DXF : symboles en blocs"), groupbox_options);
|
||||
dxf_blocks -> setToolTip(tr("Chaque symbole devient un bloc DXF, sélectionnable d'un clic dans un logiciel de CAO"));
|
||||
optionshlayout -> addWidget(dxf_blocks, 4, 1);
|
||||
|
||||
// with blocks, a symbol's texts as attributes of its block
|
||||
dxf_attributes = new QCheckBox(tr("DXF : textes des symboles en attributs"), groupbox_options);
|
||||
dxf_attributes -> setToolTip(tr("Les textes d'un symbole (repère, fonction...) deviennent des attributs de son bloc. LibreCAD n'affiche pas les attributs."));
|
||||
optionshlayout -> addWidget(dxf_attributes, 5, 1);
|
||||
connect(dxf_blocks, &QCheckBox::toggled, dxf_attributes, &QCheckBox::setEnabled);
|
||||
|
||||
vboxLayout -> addWidget(groupbox_options);
|
||||
|
||||
@@ -242,6 +251,7 @@ void ExportPropertiesWidget::build()
|
||||
setTabOrder(draw_terminals, draw_colored_conductors);
|
||||
setTabOrder(draw_colored_conductors, draw_bg_transparent);
|
||||
setTabOrder(draw_bg_transparent, dxf_blocks);
|
||||
setTabOrder(dxf_blocks, dxf_attributes);
|
||||
|
||||
// connexion du bouton permettant le choix du repertoire
|
||||
connect(button_browse, &QPushButton::released, this, &ExportPropertiesWidget::slot_chooseADirectory);
|
||||
@@ -258,6 +268,7 @@ void ExportPropertiesWidget::build()
|
||||
connect(draw_bg_transparent, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(draw_colored_conductors, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(dxf_blocks, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(dxf_attributes, &QCheckBox::stateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
#else
|
||||
connect(draw_grid, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(draw_border, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
@@ -267,5 +278,6 @@ void ExportPropertiesWidget::build()
|
||||
connect(draw_bg_transparent, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(draw_colored_conductors, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(dxf_blocks, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
connect(dxf_attributes, &QCheckBox::checkStateChanged, this, &ExportPropertiesWidget::optionChanged);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user