Automatic Light Gauge Steel Frame Creator And Panelizer macro

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
hhassey
Posts: 131
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby hhassey » Fri May 10, 2019 10:32 pm

vocx wrote:
Fri May 10, 2019 8:50 pm
What? Are you implying MP4 is not an open format? There's a lot of confusion, but MPEG-4 (both the container and the codec H.264) is an ISO standard. It's open and well supported in Linux.
From Wikipedia:

MPEG-4 contains patented technologies, the use of which requires licensing in countries that acknowledge software algorithm patents...

But I don't want to steer the discussion to mp4:
User avatar
hhassey
Posts: 131
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby hhassey » Fri May 10, 2019 10:44 pm

The Penalization algorithm is really fast, and seeks for an "optimal" solution with the pieces it is allowed to play, it works in such a way that every piece it places, it goes back and checks if the solution can be further optimized using any of the pieces on the list and so on. The algorithm cuts pieces to adjust sizes and if told so, tries to re-use the wasted cut pieces in the process. Notice how it decides that some pieces are better off horizontal and others vertical.

This is a really Hard NP Hard mathematical problem, not to mention how much more complex it makes it by adding windows and doors as well as custom minimum piece sizes.

Here is what it does on a bigger assembly. Notice that on the "Report View" the total waste is reported both as an Area or %.
Screenshot from 2019-05-10 13-56-49.png
Screenshot from 2019-05-10 13-56-49.png (193.94 KiB) Viewed 197 times
User avatar
hhassey
Posts: 131
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby hhassey » Sun May 12, 2019 2:48 am

yorik wrote:
Fri May 10, 2019 2:46 pm
This is AMAZING work Humberto! One of the most professional Arch/BIM tools we have in FreeCAD, certainly!

I would love to have this incorporated in Arch! It would be pretty easy I guess, basically placing your macros in the Arch folder, then create a FreeCAD Command for each of them (that can be in the same file), which is basically a class that contains a couple of infos such as tool name, icon... and an Activated() function that is executed when the button is pressed.

A couple of improvements that could be interesting too, in a next move...

- That the frame object would inherit ArchComponent.Component, so it gains all the IFC capabilities
- That the panels appear "swallowed" by the frame object in the tree. For that, a view provider must be created, and its claimChildren() implemented
Ok @yorik I want to try and do this, but Can you please explain me the process, I have never done something like that before. Like where to put the icons, where the python files and where the user interface file, etc... Where can I look at an example of the simple classes I need to write.
paullee
Posts: 1438
Joined: Wed May 04, 2016 3:58 pm

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby paullee » Sun May 12, 2019 3:29 am

hhassey wrote:
Fri May 10, 2019 6:50 pm
@paullee I believe the reason you can't play the video is because you must be using MacOS and they deliberately cut your freedom by not allowing you to play webm format, the reason, because it is a free format. I am aware of the issue, but all my videos are webm and not mp4 because that is another way to support freedom. So sorry for the inconvenience that apple has created on you.

Can you please try to play it with something outside the apple's i-cage ecosystem and report if there is still a problem?

P.S. I play it with GNU/Linux in firefox without any issues.

Humberto.

I in fact is on Fedora 29. Though I installed Chrome and find it play your video, just have some more findings if it help more people able to see it.

With the Firefox on Fedora, I expect it play webm as it advertised. But it does not play your video.

Chrome play it (it includes mp4, h.264 etc. learned from wiki etc.)

Chromium (the upstream version of Chrome, w/o mp4, h.264 etc support) Do Not play the video


So just suspect if your video is 'encoded' in webm / vp8.


Sorry for off-topic.
User avatar
hhassey
Posts: 131
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby hhassey » Sun May 12, 2019 3:40 am

paullee wrote:
Sun May 12, 2019 3:29 am
So just suspect if your video is 'encoded' in webm / vp8.
Sorry for off-topic.
Yes it is enconded in webm / vp8
vocx
Posts: 618
Joined: Thu Oct 18, 2018 9:18 pm

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby vocx » Sun May 12, 2019 5:03 am

hhassey wrote:
Sun May 12, 2019 2:48 am
Ok @yorik I want to try and do this, but Can you please explain me the process, I have never done something like that before. Like where to put the icons, where the python files and where the user interface file, etc... Where can I look at an example of the simple classes I need to write.
How exactly do you run the tool currently?

You should take a look at the code in the repository. In Arch, almost every object is defined in its own module. For example, the simple Arch Rebar is inside src/Mode/Arch/ArchRebar.py

If you see the ArchRebar.py file you can see this structure

Code: Select all

# A high level command to create the object programmatically,
# that is, without the interface buttons.
# For example, it would be used like
# Arch.makeSteelFrame(length=1000, width=200, panels=6, ...)
def makeRebar():

# A class that defines the command used by the interface.
# It contains standard functions that define what happens when you click on the button.
# If you see the main tree of Arch, there is "Resources/Icons"
# and "Resources/ui" folders to put the icons and user interfaces that you are using;
# these will be found automatically
class _CommandRebar:
    def GetResources(self):
    def IsActive(self):
    def Activated(self):

# A class with the internal code of your tool, again with some standard functions.
class _Rebar(ArchComponent.Component):
    def __init__(self,obj):
    def setProperties(self,obj):
    def onDocumentRestored(self,obj):
    def onChanged(self,obj,prop):
    def execute(self,obj):

# This sets the graphical properties of your object.
# Every object in FreeCAD has "base properties" and "view properties";
# the first ones can be used without a graphical interface, that is,
# when creating the objects from a script; the latter only make sense
# when you have the interface loaded, for example, things like color,
# rendering mode, line thickness, etc.
# You can copy and paste the code and make simple adjustments.
class _ViewProviderRebar(ArchComponent.ViewProviderComponent):
    def __init__(self,vobj):
    def setProperties(self,vobj):
    def onDocumentRestored(self,vobj):
    def getIcon(self):
    def setEdit(self, vobj, mode):
    def onChanged(self,vobj,prop):

# All the following definitions are auxiliary functions
# that are used everywhere else by your object, you can define as many
# as you need, and should be used in the real creation of your object
# under _SteelFrame(ArchComponent.Component), and in the other classes.
# Your main code will probably be a bunch of definitions here.
def CalculatePlacement(baramount, barnumber, size, axis, ...):
def CustomSpacingPlacement(spacinglist, barnumber, axis, ..):
def strprocessOfCustomSpacing(span_string):

# Finally, this instruction tests whether the graphical interface
# of FreeCAD is active. If it exists, then it registers the graphical command,
# together with its button icon and everything.
if FreeCAD.GuiUp:
    FreeCADGui.addCommand('Arch_Rebar', _CommandRebar())
Then in the main Arch.py file, it imports all tools defined in their own modules.

Code: Select all

import FreeCAD
if FreeCAD.GuiUp:
	import FreeCADGui
	FreeCADGui.updateLocale()

from ArchWall import *
from ArchFloor import *
from ArchFence import *
from ArchSite import *

#for example
from ArchSteelFrame import *
Last edited by vocx on Sun May 12, 2019 5:50 pm, edited 1 time in total.
User avatar
bitacovir
Posts: 542
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby bitacovir » Sun May 12, 2019 3:01 pm

hhassey wrote:
Fri May 10, 2019 10:44 pm
The Penalization algorithm is really fast, and seeks for an "optimal" solution with the pieces it is allowed to play, it works in such a way that every piece it places, it goes back and checks if the solution can be further optimized using any of the pieces on the list and so on. The algorithm cuts pieces to adjust sizes and if told so, tries to re-use the wasted cut pieces in the process. Notice how it decides that some pieces are better off horizontal and others vertical.

This is a really Hard NP Hard mathematical problem, not to mention how much more complex it makes it by adding windows and doors as well as custom minimum piece sizes.

Here is what it does on a bigger assembly. Notice that on the "Report View" the total waste is reported both as an Area or %.
Screenshot from 2019-05-10 13-56-49.png
THIS IS SPECTACULAR!!! Well done!!
If you want all people using your tool, definitely this must go in Arch WB. An external addon has the problem that people is not aware of each new WB and all the functions that they have. Now, you have the option to include some features in ArchWB and develop an External WB as expansion. Like ArchWB -> BIMWB

Also, you can offer to other light gauge steel companies to include their products as libraries.
::bitacovir::
===================================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

My Blog
Mini Airflow Tunnel Project
User avatar
hhassey
Posts: 131
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby hhassey » Fri May 17, 2019 9:01 pm

I will give it a shot on putting this on the FreeCAD code and asking for a pull / merge request. As soon as I have some time to do it.

Thanks for the good examples on what I have to do to get this done!

@yorik just out of curiosity, why is FreeCAD LGPL and not GPL ?

I would prefer not to create code that does not give the Free software world an advantage over proprietary. AFAIK LGPL will allow proprietary programs to take your code and use it. Did I miss something? But if it is necessary to get it into FreeCAD I will.
vocx
Posts: 618
Joined: Thu Oct 18, 2018 9:18 pm

Re: Automatic Light Gauge Steel Frame Creator And Panelizer macro

Postby vocx » Fri May 17, 2019 11:47 pm

hhassey wrote:
Fri May 17, 2019 9:01 pm
...
@yorik just out of curiosity, why is FreeCAD LGPL and not GPL ?
...
See Licence.
jrigel wrote: I know that the discussion on the right licence for open source occupied a significant portion of internet bandwidth and so is here the reason why, in my opinion, FreeCAD should have this one.

I chose the LGPL for the project and I know the pro and cons about the LGPL and will give you some reasons for that decision.

FreeCAD is a mixture of a library and an application, so the GPL would be a little bit strong for that. It would prevent writing commercial modules for FreeCAD because it would prevent linking with the FreeCAD base libs. You may ask why commercial modules at all? Therefore Linux is good example. Would Linux be so successful when the GNU C Library would be GPL and therefore prevent linking against non-GPL applications? And although I love the freedom of Linux, I also want to be able to use the very good NVIDIA 3D graphic driver. I understand and accept the reason NVIDIA does not wish to give away driver code. We all work for companies and need payment or at least food. So for me, a coexistence of open source and closed source software is not a bad thing, when it obeys the rules of the LGPL. I would like to see someone writing a Catia import/export processor for FreeCAD and distribute it for free or for some money. I don't like to force him to give away more than he wants to. That wouldn't be good neither for him nor for FreeCAD.

Nevertheless this decision is made only for the core system of FreeCAD. Every writer of an application module may make his own decision.

Jürgen Riegel, 15 October 2006
So, FreeCAD tries to coexist in this world with other tools, both proprietary and free. It does not go deep into ideological positions about freedom; use what is best for you.

Also, if you read the comments of new users who come to the forum, many of them outright complain that FreeCAD is "trash", "buggy", "incomplete", "inferior", etc. So for them, FreeCAD isn't good enough, and basically has zero advantages over their paid, proprietary CAD packages. So, it really seems FreeCAD doesn't provide an advantage over proprietary CAD software.

GPL is mostly used when you have a clear winner paradigm that doesn't exist anywhere else. But FreeCAD is basically a clone of Catia, SolidWorks, Revit, Autocad, etc. What FreeCAD provides already exists somewhere else; there is no real advantage, other than being free of charge.