pyBar

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
bernd
Posts: 8488
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: pyBar

Postby bernd » Tue Dec 03, 2013 9:38 pm

I couln'd help to read more about the FEM Module, netgen and calculix. My understanding is for an appropriate FEM mesh you need appropriate input date means for shell meshes you need some plane shapes like faces and for an beam mesh (truss calculation like pyBar) you need some 1D axis. At the end, if we would like to generate a mesh what is not a volume (solid) mesh we need the axis stuff yorik made a mantis entry for.

It seams for now pybar is the solution which is easier to get results with.

But one day if the fem wb is ready to use even with beams an shells we are capable of calculating everything what we could model directly from CAD. :D Something like this probably. http://www.ingware.ch/referenzen/massiv ... orenz.html

bernd
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: pyBar

Postby yorik » Fri Dec 06, 2013 5:14 pm

Yes I also think something like pybar is a good start... Too bad I didn't receive a reply from its author... When I have a minute again I'll implement that axis stuff so we can look at what to do next...
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: pyBar

Postby yorik » Sun Dec 15, 2013 7:52 pm

Ok I added the new system:

Image

The structural objects now have an additional property called Nodes, which stores a list of FreeCAD Vectors. These nodes are recalculated on shape change, except if they have been manually changed. They can be displayed in the 3D view using the "Show Nodes" view property (there are mode properties to set the color and width)

So far that is all it does. If one wants to change the nodes, it must be done by python (for example, myObj.Nodes = [ myObj.Nodes[0], myObj.Nodes[1].add(FreeCAD.Vector(.2,0,0) ]

There is still no pybar export, but that should be simple now.
User avatar
rockn
Posts: 1589
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: pyBar

Postby rockn » Mon Dec 16, 2013 1:46 am

Look very cool !
I going to compile FreeCAD since I can't wait the building of ppa.
Formations et tutoriels FreeCAD en Français, soutenez moi : https://www.tipeee.com/formations-freecad
User avatar
bernd
Posts: 8488
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: pyBar

Postby bernd » Tue Dec 17, 2013 10:23 pm

rockn wrote:Look very cool !...
It actually is very cool. Works even for double T crosssections :) I need to play with it on more complex structures.

Yorik, ist it imaginable to have the same to slabs but insdead of a axis line it would be an axis face. This stuff is so great. It will be possible to save an analytical model inside an geometrical modell, its just unbelivable and it looks so simply.

Yorik have you ever reading about IFC2x3 Structural Analysis View (the IFC subset to exchange the structural analysis model from a structural modeling to a structural analysis application) ? This file format actually consits basically of stuff like this, axis for columns and beams as well as faces for walls and slabs.
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: pyBar

Postby yorik » Wed Dec 18, 2013 12:46 am

Yes, we could upgrade the system... It could even be pretty simple, use the same Nodes property, since we only need 2 vectors to define a plane. Then, depending on the role of the element, we show a line/polyline or a plane.
I didn't know IFC2.3 had such stuff... I'll have a look
User avatar
bernd
Posts: 8488
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: pyBar

Postby bernd » Wed Dec 18, 2013 6:38 pm

yorik wrote:Yes, we could upgrade the system... It could even be pretty simple, use the same Nodes property, since we only need 2 vectors to define a plane. Then, depending on the role of the element, we show a line/polyline or a plane.
...
:D

attached some simply example ifc as arch-ifc and analytical-ifc.
Attachments
screen2.jpg
screen2.jpg (82.92 KiB) Viewed 3602 times
screen.jpg
screen.jpg (66.37 KiB) Viewed 3602 times
analytical-ifc.zip
(188.34 KiB) Downloaded 129 times
User avatar
bernd
Posts: 8488
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: pyBar

Postby bernd » Thu May 29, 2014 11:00 am

Might be interesting in this regard. viewtopic.php?f=18&t=6589
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: pyBar

Postby yorik » Sat Jun 27, 2015 12:10 am

After a long time, some updates on this subject! I had some discussion with the pybar developer, and things are moving. He's now working on making pybar work from the command line, and I'm trying to convince him to make pybar translatable...

In the meantime, I did some changes to the SVG importer of FreeCAD so it can import pybar's SVG results. This would allow to do some cool things like this:
structure-screenshot.jpg
structure-screenshot.jpg (185.18 KiB) Viewed 2242 times
This is just the SVG file imported, scaled, and positioned against a structure, manually. But it gives the idea of what would be achievable without too much effort. Basically in a first moment I'm planning to:

- Add a couple of tools to edit the structural nodes of the Arch structures, so one can make them meet
- Allow to export a pybar file (with just the geometry, without the loads, one would need to put the loading in pybar for now)
- Allow to automatically import and display the result at the correct location on the model

After that we could look at how we could define loads on the Arch structures (that could be used in FEM too), but that's another story...

A little question that annoys me, the pybar files needs the quadratic moments from the sections of the structural members. Calculating that is not hard for rectangular sections, but we should have something that works for any kind of section. Anyone of you engineering gurus has an idea on the subject?
looo
Posts: 2965
Joined: Mon Nov 11, 2013 5:29 pm

Re: pyBar

Postby looo » Sat Jun 27, 2015 3:30 pm

A little question that annoys me, the pybar files needs the quadratic moments from the sections of the structural members.
I had a try on this. The code use simplest integration, so not very accurate. Also it would be better to go through every edge and discretize it instead of discretize the wire.
Maybe Opencascade has allready something implemented to calculate this properties?

Code: Select all

import Part


def Moment_2(sketch):
    # 1 get inner and outer wire
    wires = sketch.Shape.Wires

    # check boundingbox diagonals to get outer shape
    diagonals = [wire.BoundBox.DiagonalLength for wire in wires]
    pos = diagonals.index(max(diagonals))

    # reordering
    outer_wire = wires[pos]
    wires.pop(pos)
    wires.insert(0, outer_wire)

    Ix = 0
    Iy = 0
    for j, wire in enumerate(wires):
        pts = wire.discretize(1000)
        ix = 0
        iy = 0
        for i, pt in enumerate(pts[:-1]):
            # one point integration
            midpoint = (pts[i] + pts[i + 1]) * 0.5
            diff = pts[i] - pts[i + 1]
            ix += midpoint.y ** 3 * diff.x / 3.
            iy += midpoint.x ** 3 * diff.y / 3.

        Ix += ((j == 0)*2 - 1) * abs(ix)
        Iy += ((j == 0)*2 - 1) * abs(iy)

    return(Ix, Iy)


a = App.ActiveDocument.Sketch
print(Moment_2(a))
please help with my conda-packaging efforts: https://liberapay.com/looooo/