Dev logs of Rebar Addon for FreeCAD - GSoC project

Contributions from the participants, questions and answers to their projects.
Discussions of proposals for upcoming events.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Tue Jun 06, 2017 3:24 pm Something like this:

TaskPanelStraightRebar.svg
It's good. I will add more description in that image like what is front cover, side cover etc.

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Tue Jun 06, 2017 3:28 pm I still have problems running your script... even selecting a face, I couldn't make it create a rebar yet. It finishes, says "Done" but there is an empty sketch created, the dialog is not closed, and no rebar object is created.
Now, I have updated my scripts and removed try statements. Try to run my scripts as macros (Macro > Macros > change the macros location to FreeCAD-Reinforcement > select the StraightRebar.py > Execute).
Note: Before executing this scripts first select the face of the structural element.

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
yorik
Founder
Posts: 13630
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by yorik »

There is one more thing, the module "App" only exists in the console and the macro environment. You should use "FreeCAD" instead (FreeCAD.Vector, etc...)

I still cannot seem to make your script run... I chose a face, put 1 cm border everywhere, 2 x 5mm bars and nothing happens. The output windows says: Done!, the task dialog doesn't close, an empty sketch is produced. No error message.

About the system I explained above, to make it possible to edit the rebar with one of your scripts, the idea is to add a App::PropertyString to the Rebar (it could be in the view provider, since it will work in GUI mode only anyway), that holds the name of the python module responsible ("StraightRebar" for example). The property can be hidden with setEditorMode(propname, 2)

Then in the same view provider, the setEdit() function must be reimplemented (currently uses the one from its parent class), and check if that property exists and if it contains something. If yes, it must try a "import ModuleName" and run "ModuleName.editDialog(RebarObject)"

Then you need of course to have such an editDialog() in each of your scripts.
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Fri Jun 09, 2017 3:25 am There is one more thing, the module "App" only exists in the console and the macro environment. You should use "FreeCAD" instead (FreeCAD.Vector, etc...)
I already fix it.
yorik wrote: Fri Jun 09, 2017 3:25 am I still cannot seem to make your script run... I chose a face, put 1 cm border everywhere, 2 x 5mm bars and nothing happens. The output windows says: Done!, the task dialog doesn't close, an empty sketch is produced. No error message.
Now, I have updated my code and removed all try, except statements. Also added checks and image in the dialog box. Please follow the steps which I have shared in my previous post to run my code (https://forum.freecadweb.org/viewtopic. ... 10#p177102).
yorik wrote: Fri Jun 09, 2017 3:25 am About the system I explained above, to make it possible to edit the rebar with one of your scripts, the idea is to add a App::PropertyString to the Rebar (it could be in the view provider, since it will work in GUI mode only anyway), that holds the name of the python module responsible ("StraightRebar" for example). The property can be hidden with setEditorMode(propname, 2)

Then in the same view provider, the setEdit() function must be reimplemented (currently uses the one from its parent class), and check if that property exists and if it contains something. If yes, it must try a "import ModuleName" and run "ModuleName.editDialog(RebarObject)"
Here, what is ModuleName? Is it be a filename or class name of rebar (like _StraightRebarTaskPanel)?

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
yorik
Founder
Posts: 13630
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by yorik »

Okay, now it works!

A couple of minor issues are left:
Screenshot from 2017-06-09 15-05-58.png
Screenshot from 2017-06-09 15-05-58.png (258.83 KiB) Viewed 2466 times
1) "The graph must be a DAG." error message. This happens probably because the sketch depends on the structure, then the rebar on the sketch, then the structure on the rebar (it is added to its "attributes" property). There is an arch preference setting to define how to deal with that problem (removing the sketch support or creating an additional structure. This is not really something you need to take care of now...

*EDIT* Actually a revolutionnary idea is striking my mind now, instead of having the wall host the window, or the structure the rebar (the two emblematic cases now), why not do the contrary! Have the window remember which wall it is hosted in, and the rebar hold which structure it is part of...

2) The dialog is not closed after your script finishes. I think you might need to call FreeCADGui.Control.closeDialog() somewhere...

3) The normal direction in which the rebars are spreading is wrong in the example above (I picked the highlighted face)
amrit3701 wrote: Fri Jun 09, 2017 4:38 pmHere, what is ModuleName? Is it be a filename or class name of rebar (like _StraightRebarTaskPanel)?
It is a filename that you can import in python (ex. StraightRebar.py, so you can do "import StraightRebar")
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Fri Jun 09, 2017 6:20 pm
In continuation of the discussion at IRC (on 2017-06-09 at 19:25 - http://freecadlog.archivist.info/previous.php), following is my problem statement.

Creating reinforcement with my scripts in the structural element is actually quite tedious task for a structural engineer. For e.g. if a user wants to create reinforcement in the footing, then he/she has to select the face number of times, like to create rectangular footing mesh, a user has to select face two times or run my script two times. Further, footing may have a top mesh which requires further selection of face two times more.

IMO, if we can make our approach more natural to workflow of a structural engineer, then we can win a heart of a structural engineer.

On brainstorming with structural engineers, they suggested to take all the data of the footing from the user in the beginning through the form (dialog box) and then process all the values. I think this approach is good as compared to the current approach.

@Yorik and Bernd
What are your views on my above suggestion?

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
yorik
Founder
Posts: 13630
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by yorik »

I think you can have both: Something simple with presets, or let the user fin-tune things and select him/herself the exact face to build things on. In other words, we should of course make things simpler for newer users, but this should never restrict the possibilities for the power user.

Basically you could detect what input object you have: If you have a structure, look at its base shape. If the base shape is a solid, then it will be hard to apply presets because that solid could be anything. If the structure has a base shape but that base shape is flat (only faces/wires, no solid), you already know that the final shape is formed by extruding that. You might be able to automate something. If there is no base shape, then the shape of the structure is defined by length, width, height, then you can certainly automate much more.

I think in the last case, you might be able to automate quite a lot. And let the power user do things more manually in the other cases.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by saso »

yorik wrote: Sun Jun 11, 2017 5:27 pm I think you can have both: Something simple with presets, or let the user fin-tune things and select him/herself the exact face to build things on. In other words, we should of course make things simpler for newer users, but this should never restrict the possibilities for the power user.
+1

This, plus a system to upgrade / downgrade between the two could easily become the mantra for everything we add to FC :) And note that the preset "simple" things / workflow if made good enough can be very useful also for power users, indeed it can limit you in the freedom of the design but it can help you work fast and consistent (by some standard).
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Sun Jun 11, 2017 5:27 pm I think in the last case, you might be able to automate quite a lot. And let the power user do things more manually in the other cases.
Yorik, I have sent a PR (https://github.com/FreeCAD/FreeCAD/pull/822) to FreeCAD master repository. Kindly, accept this PR.

After this PR, please test my code on straight rebar (https://github.com/amrit3701/FreeCAD-Reinforcement). Now, a user can edit the rebar which he/she is created by using dialog box.

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
User avatar
amrit3701
Posts: 343
Joined: Mon Jun 13, 2016 5:37 pm

Re: Dev logs of Rebar Addon for FreeCAD - GSoC project

Post by amrit3701 »

yorik wrote: Sun Jun 11, 2017 5:27 pm
Hi Yorik,

I think I should first complete a cycle of one rebar (i.e. straight rebar) by adding it to Arch workbench before start creating C/U shape rebar. By using this, the user will have the facility to create straight rebar reinforcement. Can you tell a way to add my code in the Arch WB as you said on the IRC?

Regards,
Amritpal Singh
Github, Like my work, sponsor me!
Post Reply