Creating a new workbench for photovoltaic

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
JavierBrana
Posts: 31
Joined: Thu Sep 06, 2018 5:43 pm

Re: Creating a new workbech for photovoltaic

Post by JavierBrana »

Maybe it is very difficult to do this in 3D and maybe the best option is go to the 2D:

I used Energy 3d several times to test it. If you read its code you can check that they use the collision between two polygons. But once again I cannot find information about this matter.

About the idea of Kunda1 of using pysolar, well this is the 3th work I want to do but in the future, with simulation and visual irradiation analysis and shadow analysis.
ian.rees
Posts: 696
Joined: Sun Jun 15, 2014 3:28 am
Contact:

Re: Creating a new workbech for photovoltaic

Post by ian.rees »

Just a note that I've moved this from Developer's Corner, as I think it'll get a bit more traction here.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Creating a new workbech for photovoltaic

Post by Kunda1 »

JavierBrana wrote: Thu Sep 06, 2018 6:15 pm The real problem is that I do not find necessary information to be able to repeatedly place an object inside an area and detect that it is inside.

Another thing that I have searched and I have not found is that from the geo date I get a loft with many faces and I want to make a slope analisys of each one. The problem is that to do this I need to paint each face separately. I have managed to detect each face but I can not paint them separately.

Can someone help me?
Can you elaborate a little bit more what you are trying to achieve here ?
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
JavierBrana
Posts: 31
Joined: Thu Sep 06, 2018 5:43 pm

Re: Creating a new workbech for photovoltaic

Post by JavierBrana »

Kunda1 wrote: Sun Sep 16, 2018 10:58 pm Can you elaborate a little bit more what you are trying to achieve here ?
I´m only requesting info about how to place a rectangle inside a polygon. If Freecad has this function or I have to use my own functions. If I can do it in 3D or 2D and if I can do it in 3D, what funcions?
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Creating a new workbech for photovoltaic

Post by microelly2 »

JavierBrana wrote: Thu Sep 06, 2018 6:15 pm The real problem is that I do not find necessary information to be able to repeatedly place an object inside an area and detect that it is inside.

Another thing that I have searched and I have not found is that from the geo date I get a loft with many faces and I want to make a slope analisys of each one. The problem is that to do this I need to paint each face separately. I have managed to detect each face but I can not paint them separately.

Can someone help me?
The points data can be used to calculate a BSpline surface for the terrain. Withg this face you can calculate a face normal vector or the tangent pair for each point and map a square to this point.
the imported points from geodata workbench define a quad mesh structure in most cases and the interpolation of such points to curves/faces should work.
JavierBrana
Posts: 31
Joined: Thu Sep 06, 2018 5:43 pm

Re: Creating a new workbech for photovoltaic

Post by JavierBrana »

Hi.
To make the contours I use the function "slice" but it is very slow and I can not get a polyline:

Code: Select all

def Contours(obj, minor = 1000, mayor = 5000):
    import Part
    from FreeCAD import Base

    if obj is not None:
        ZMin = obj.Shape.BoundBox.ZMin // 10000
        ZMin *= 10000
        ZMax = obj.Shape.BoundBox.ZMax

        inc =  ZMin
        count = 0
        while inc < ZMax:
            wires = list()
            shape = obj.Shape

            for i in shape.slice(Base.Vector(0, 0, 1), inc):
                wires.append(i)

            comp = Part.Compound(wires)
            slice = FreeCAD.activeDocument().addObject("Part::Feature", str(inc/1000))
            slice.Label = str(inc/1000)
            slice.Shape = comp
            slice.purgeTouched()
            del slice, comp, wires, shape
            inc += 10000
            count += 1

        print ("Total de curvas de nivel: " + str(count))
some idea about how I can do it faster?


.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Creating a new workbech for photovoltaic

Post by microelly2 »

To get a polyline you can discretize the slice segments: There is a method discretize for Edges.

but I have no idea what is better than slice to get the contours.
You can look for algorithms in image processing
http://scikit-image.org/docs/dev/auto_e ... tours.html
http://www.scipy-lectures.org/intro/mat ... ur_ex.html
or in open cv

you have to calculate a elevation grid from your face and use it as an image with the height as color.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Creating a new workbech for photovoltaic

Post by Kunda1 »

JavierBrana wrote: Tue Sep 25, 2018 9:56 am
Any luck following microelly2's advice ?
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Creating a new workbech for photovoltaic

Post by Kunda1 »

microelly2 wrote: Tue Sep 18, 2018 11:52 am
JavierBrana wrote: Thu Sep 06, 2018 6:15 pm The real problem is that I do not find necessary information to be able to repeatedly place an object inside an area and detect that it is inside.

Another thing that I have searched and I have not found is that from the geo date I get a loft with many faces and I want to make a slope analisys of each one. The problem is that to do this I need to paint each face separately. I have managed to detect each face but I can not paint them separately.

Can someone help me?
The points data can be used to calculate a BSpline surface for the terrain. Withg this face you can calculate a face normal vector or the tangent pair for each point and map a square to this point.
the imported points from geodata workbench define a quad mesh structure in most cases and the interpolation of such points to curves/faces should work.
@microelly2 check this out: http://rdcu.be/vRj5 (it can be used as an addon in Blender)
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
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Creating a new workbech for photovoltaic

Post by microelly2 »

Kunda1 wrote: Sat Oct 06, 2018 2:33 pm @microelly2 check this out: http://rdcu.be/vRj5 (it can be used as an addon in Blender)
Interesting project,
the question is how to connect it with FreeCAD.
Use a data exchange module between FreeCAD and Blender
or rewrite the interface from Blender to FreeCAD
VI-suite has 16 kloc, this is nearly the complexity of geodat wb or the curves wb.
we should ask the developer Ryan Southall about the complexity to write a FreeCAD interface.
Post Reply