I have put my all development logs of my GSoC project on regular basis here.
Also, you can also check my development logs (https://brlcad.org/wiki/User:Amritpal_singh/GSoC17/logs).
Regards,.
Here is code: https://github.com/amrit3701/FreeCAD-Reinforcement
I believe the best way is to make the user pick a face himself. As this can be confusing (the user might be in doubt what face needs to be picked), you could add a little svg diagram on top of the dialog to illustrate what he needs to do, a bit in the same style as the diagrams in the Arch structure -> concrete prefab presets. So an easy way would be to (maybe) add such a diagram (how are your drawing skills?amrit3701 wrote: ↑Fri Jun 02, 2017 10:52 am1. I have used some constant in my code like if a user selected rebar along length then the sketch will be drawn on Face1 of the structural element and if a user selected rebar along width then sketch will be drawn on Face6. But due to topological naming problem Face1 always not along the length of the structural element and same for Face6.
I don't think the placement origin is really important, but it is doable, once you have a face, you could simply take its CenterOfMass attribute and its normal direction (normalAt()). With these two things, you can get a center point and a rotation (The App.Rotation object has several useful construction methods,one is by giving it a "from" and "to" vectors). Then you set the placement of your sketch from these two things (you must create a new placement, then give that placement to the sketch).amrit3701 wrote: ↑Fri Jun 02, 2017 10:52 am2. I have defined things like the origin of the sketcher will locate on the left side for the Face1 and in the centre for Face6 because I unable to find the relationship between the sketcher origin with respect to different faces of the structural element.
Code: Select all
ui = FreeCADGui.UiLoader()
myField = ui.createWidget("Gui::InputField")
I have fix all the bugs which I have discussed in my previous post and also use FreeCAD widgets to create UI of straight rebar taskpanel.yorik wrote: ↑Fri Jun 02, 2017 7:27 pm4. Instead of simple QLineEdit fields, you should use our FreeCAD Gui::InputField, which supports units, expressions,etc. These should normally be in your QDesigner if you compiled the FreeCAD plugin for it. Otherwise, you can also add them from the python code, after you loaded the .ui file:
Code: Select all
ui = FreeCADGui.UiLoader() myField = ui.createWidget("Gui::InputField")
Okay, I will fix them.yorik wrote: ↑Tue Jun 06, 2017 3:04 pm4) It is not obvious to the user at all that he/she needs to select a face of a structural element before running the script, and it fails silently without informing the user. You should at least check, when the script starts, if the selection contains what you want. Even better, on your ui, the selected face could appear, and a way to change the selected face should be offered (a simple "use selected face" button maybe). There could be a small image illustrating what face should be picked too, I'll try to make one for you.
5) The radio buttons amout/spacing are both unselected at script startup. I would set one selected as default...
*EDIT* 6) It is not clear in which unit the diameter is expressed
Great sound! Actually, I also have the same idea like if a user wants to re-change the values present in the dialog box then they will double click on the rebar and then a dialog box will re-open in the task panel. I will try to implement this.yorik wrote: ↑Tue Jun 06, 2017 3:04 pmNow I have another, more general idea. That is more for the long-term but it would be good to add at some point, I think:
It would be good that, if the user created a Rebar object with one of your dialogs, it would be possible to edit that Rebar later, with the same dialog. To achieve that, we could do something like this:
1) We add a (hidden) property to the Rebar, for ex "UiModule", which contains the name of the script used to produce the rebar, for ex. "TaskPanelStraightRebar".
2) In all your script, there sould be a same function, for ex. editDialog(rebar). You must make sure that, given the rebar object, that function would be able to fill the dialog with correct values again. You should also change your current script so it is possible to import it without running anything.
3) When double-clicking a Rebar object, if the UiModule property contains something, the corresponding module is imported, and its editDialog() function is ran.
4) You must modify the Accept function, so if an existing rebar was provided, change its properties as needed instead of creating a new one.
How does that sound?