LubomirJagos / FreeCAD-OpenEMS-Export-Plugin-Documentation

Tutorial how to build and simulate electromagnetic structures using FreeCAD and OpenEMS.
7 stars 1 forks source link

Highlighting of objects #2

Open istra711 opened 2 months ago

istra711 commented 2 months ago

Hi Jagos,

first of all I would like to point out that you have created a very good and helpful tool! It really makes the creation of 3D objects for OpenEMS simulations much easier and brings OpenEMS close to the functionality of well known commercial software! While using the macro, I noticed that it would be convenient if it would be possible to highlight an object in the FreeCAD GUI by clicking on the object in the left window ("Object Assignment") of the ExportOpenEMSDialog-Macro. Right now objects are only highlighted when they are already assigned to right window. If structures are imported with many stubs or microstrip lines renaming each single one with "meaningful names" would be somewhat tedious, then it would be very handy if one by one could be highlighted and assigned directly to the right window.

I am not familiar with python but I added this to "ExportOpenEMSDialog.py" (~line 200):

self.form.objectAssignmentLeftTreeWidget.itemSelectionChanged.connect(self.objectAssignmentLeftTreeWidgetItemSelectionChanged)

and this (~line 858):

    def objectAssignmentLeftTreeWidgetItemSelectionChanged(self):
        currItemLabel = self.form.objectAssignmentLeftTreeWidget.currentItem().text(0)
        print(currItemLabel)
        if (currItemLabel):
            self.cadHelpers.clearSelection()
            self.cadHelpers.selectObjectByLabel(currItemLabel)

and that seems to solve my problem. Maybe you can check this and add it to the next release of the code.

Cheers, Michael

LubomirJagos42 commented 2 months ago

hi, thanks for this, yes looking on this is how it should be done, you added handler to event on left tree widget, I will put it into code.

Thanks for using my addon, if you have other question feel free to ask.

LubomirJagos42 commented 2 months ago

ok, your changes were added into v0.4.3-alpha https://github.com/LubomirJagos42/FreeCAD-OpenEMS-Export/releases