Rebar tool isssue with columns

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Rebar tool isssue with columns

Post by Joel_graff »

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 1689 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?
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Rebar tool isssue with columns

Post by yorik »

Joel_graff wrote: Tue Apr 24, 2018 3:18 pmIt 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
Veteran
Posts: 3155
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Rebar tool isssue with columns

Post by thschrader »

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 1647 times
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Post by Joel_graff »

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...
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Rebar tool isssue with columns

Post by Kunda1 »

Calling reinforcements ;)
amrit3701 wrote:ping
chakkree wrote:ping
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
chakkree
Posts: 327
Joined: Tue Jun 30, 2015 12:58 am
Location: Bangkok Thailand

Re: Rebar tool isssue with columns

Post by chakkree »

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 1624 times
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Post by Joel_graff »

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
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Post by Joel_graff »

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
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Rebar tool isssue with columns

Post by yorik »

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
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Rebar tool isssue with columns

Post by Joel_graff »

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.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Post Reply