Rebar tool isssue with columns

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
Joel_graff
Posts: 1355
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Rebar tool isssue with columns

Postby Joel_graff » Tue Apr 24, 2018 3:18 pm

I'm working with the rebar tool to build box culvert designs. I've even added a new rebar shape - the J-shape or "hook" shape.

At the moment, though, I'm trying to lay out two sets of straight bar which lie orthogonal to each other in a cubic shape. It's easy enough to do with a horizontal arrangement, but I can't make it work in the vertical.
Capture.JPG
Capture.JPG (43.2 KiB) Viewed 578 times
In the image above, the "front" lies on the X-Z plane and the first run of vertical bar was achieved by picking the front face and specifying a vertical / right alignment.

I attempted to generate the horizontally-oriented bar by picking the bottom face and using the same layout.

After poking through the code, the first problem is that the center-of-mass of the lower face is returned incorrectly. The error occurs in Rebarfunc.getParametersOfFace(). It actually identifies the center of mass of the lower face correctly, but then changes the values because of the face's orientation on the XY plane.

I can fix it, but I'd have no idea what I'm breaking if I do. Am I misunderstanding how to go about doing this?
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
yorik
Site Admin
Posts: 11371
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Rebar tool isssue with columns

Postby yorik » Wed Apr 25, 2018 8:03 pm

Joel_graff wrote:
Tue Apr 24, 2018 3:18 pm
It actually identifies the center of mass of the lower face correctly, but then changes the values because of the face's orientation on the XY plane.
I don't know why it is so, @Amritpal should be able to tell he he reads this... Otherwise, if it works correctly for you that way I would fix it then make a pull request on his repo, so he'll be able to see if it's good or not
thschrader
Posts: 1402
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Rebar tool isssue with columns

Postby thschrader » Wed Apr 25, 2018 9:42 pm

Joel_graff wrote:
Tue Apr 24, 2018 3:18 pm
I attempted to generate the horizontally-oriented bar by picking the bottom face and using the same layout.
Hi Joel,
you can generate the horizontal rebars by using the "custom-rebar" option.
Select the upper face and draw a sketch on it.
custom_rebar.JPG
custom_rebar.JPG (97.01 KiB) Viewed 536 times
User avatar
Joel_graff
Posts: 1355
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Postby Joel_graff » Wed Apr 25, 2018 11:11 pm

thschrader wrote:
Wed Apr 25, 2018 9:42 pm
Hi Joel,
you can generate the horizontal rebars by using the "custom-rebar" option.
I'll give that a try. I spent a couple hours sorting out the code and didn't get it done...
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
Kunda1
Posts: 4755
Joined: Thu Jan 05, 2017 9:03 pm

Re: Rebar tool isssue with columns

Postby Kunda1 » Thu Apr 26, 2018 1:26 am

Calling reinforcements ;)
amrit3701 wrote:ping
chakkree wrote:ping
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
chakkree
Posts: 288
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Rebar tool isssue with columns

Postby chakkree » Thu Apr 26, 2018 4:49 am

In vertical panel, I cannot put rebar's mesh in the correct position. :(

StraigthRebar_in_vertical_Panal.png
StraigthRebar_in_vertical_Panal.png (533.17 KiB) Viewed 513 times
User avatar
Joel_graff
Posts: 1355
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Postby Joel_graff » Thu Apr 26, 2018 3:55 pm

I should have solved this, but something's wrong. Probably something stupid I'm doing.

See post in the Python Scripting forum:

https://forum.freecadweb.org/viewtopic.php?f=22&t=28396
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
Joel_graff
Posts: 1355
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Postby Joel_graff » Mon Apr 30, 2018 1:09 pm

My post got moved, but I've made a little progress on this bug.

Basically, I need to figure out how to rotate a sketch.

That is, I need to change the SketchObject.Placement.Rotation property, which appears to be read-only.

https://forum.freecadweb.org/viewtopic.php?f=3&t=28396
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
yorik
Site Admin
Posts: 11371
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Rebar tool isssue with columns

Postby yorik » Mon Apr 30, 2018 6:48 pm

Joel_graff wrote:
Mon Apr 30, 2018 1:09 pm
That is, I need to change the SketchObject.Placement.Rotation property, which appears to be read-only.
You cannot change the rotation of a placement that is already used by an object. The solution is to copy that placement ( newPlacement = App.Placement(originalObject.Placement) ), then you'll be able to change the rotation, then replace the placement: originalObject.Placement = newPlacement
User avatar
Joel_graff
Posts: 1355
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Postby Joel_graff » Mon Apr 30, 2018 7:08 pm

yorik wrote:
Mon Apr 30, 2018 6:48 pm
You cannot change the rotation of a placement that is already used by an object. The solution is to copy that placement ( newPlacement = App.Placement(originalObject.Placement) ), then you'll be able to change the rotation, then replace the placement: originalObject.Placement = newPlacement
I had that same thought after I created the post. No effect.

Here's the code I used (adjusted to match your use of 'App.Placement()':

Code: Select all

    default_placement = FreeCAD.Placement(sketch.Placement)

    sketch.Support = [(structure, facename)]

    sketch.Placement = default_placement

    FreeCAD.ActiveDocument.recompute()

The value of default_placement doesn't change (I was afraid it was a reference and not static - Python is still a bit of a mystery to me at times).

The value of sketch.Placement still reverts to it's 180-degree rotation after recompute() is called.
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails