Section presets in Arch module

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
robin
Posts: 6
Joined: Wed Dec 09, 2015 2:01 pm

Section presets in Arch module

Post by robin »

Hi,
First of all, Freecad has been a very useful tool for me, I've been using it for years to model all sorts of things I make at my local maker space in Auckland. I'm currently using it to design my house boat and have also done various pieces of furniture, sculptures, room layouts and so on.

My second point is about the "section" presets in the Arch module, I notice they are hardcoded into the Python script at /usr/lib/freecad/mod/arch/archstructure.py and wondered why this was? When I first poked around for them, I assumed they would be in /usr/share/freecad/, perhaps in a series of text files, but was rather surprised to see them in /usr/lib. Is there any particular reason for this? I ask as I think there are many users who would like to extend them, either by releasing packs of profiles in additional packages, or by adding them to their /home/<user>/.freecad/ directory. I for one would like to do this.

Cheers, and keep up the good work.

Robin
Last edited by robin on Mon Dec 28, 2015 2:07 pm, edited 1 time in total.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Structure presets in Arch module

Post by jmaustpc »

Your first post, welcome to FreeCAD.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Section presets in Arch module

Post by yorik »

Of course, all these presets should at some point being manageable by the user... It's just that so far there hasn't been so much use and so many presets to make it happen, and nobody thought either about the way to store them. But it should definitely happen.
robin
Posts: 6
Joined: Wed Dec 09, 2015 2:01 pm

Re: Section presets in Arch module

Post by robin »

This is something I'm interested in doing, what would it take to add this feature to Freecad? If I was to put together a set of packages containing sections, with their names and other (widely researched) relevant information, would anyone be willing to modify the code to make use of them? If I start this as a sub-project, say on Github, it should be trivial to allow other members of the community to add sections as they wish and install via a repository on Launchapd, etc.

I guess an earlier question would be, does anyone know of any existing, appropriately-licensed libraries of sections that could be modified?

Cheers
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Section presets in Arch module

Post by yorik »

You'll need to learn some python, if you don't know it yet, and a bit about how opencascade works...

Basically, look at the beginning of ArchStructure.py. It defines a "Presets" list, which is a list containing lists. the format of the contained lists is given at line 46. The Presets list is then used at line 436, if the choosen preset has more than 4 values (otherwise it's a simple rectangular section), and its values are passed to the makeProfile function at line 355, which creates a Profile object. At the moment, that's it.

So you must define what you want to do: Create more kinds of profiles? How will they be defined? What parameters will they need? I think you should start by looking at that, and then extending the Profile object (line 741) so it can draw all the profiles you want (and not break any of the existing functionality of course). Another option would be to make different Profile + makeProfile() pairs for the different kinds of profikes (SquareProfile, BeamProfile, somehting like that). Once this is working, then I would look at how to move the Presets list to something external.

No small work ;)
JAndersM
Posts: 63
Joined: Tue Dec 22, 2015 1:35 pm

Re: Section presets in Arch module

Post by JAndersM »

robin wrote:My second point is about the "section" presets in the Arch module, I notice they are hardcoded into the Python script at /usr/lib/freecad/mod/arch/archstructure.py and wondered why this was?
I noticed the same thing.
I ask as I think there are many users who would like to extend them, either by releasing packs of profiles in additional packages, or by adding them to their /home/<user>/.freecad/ directory. I for one would like to do this.
Agree. Made a first step towards his yesterday. Se this topic.
I thought about changing the loading so it will search a standard file of profiles and then add profiles from the users directory. Just as you suggested.
yorik wrote:create more kinds of profiles? How will they be defined? What parameters will they need? I think you should start by looking at that, and then extending the Profile object (line 741) so it can draw all the profiles you want (and not break any of the existing functionality of course).
This needs some thought. In my experiment I introduced a letter defining the profile to be created by Profile. (Now only using the existing two types.) But it might be better solutions.

An other thought is that its not only profiles that might be loaded both from a default file and a user file (or URL). So the developers have to decide witch file format to use (cvs, xml...?) as general data format. A common filer reader module that handles reading these data files would then be a good thing.
JAndersM
Posts: 63
Joined: Tue Dec 22, 2015 1:35 pm

Re: Section presets in Arch module

Post by JAndersM »

yorik wrote: I think you should start by looking at that, and then extending the Profile object (line 741) so it can draw all the profiles you want (and not break any of the existing functionality of course). Another option would be to make different Profile + makeProfile() pairs for the different kinds of profikes (SquareProfile, BeamProfile, somehting like that).
I made a new version of ArchStructure to accommodate different kinds of profiles as well as reading profiles from a file:
*It reads profiles from a csv file (Data/beams.csv) and the defined profiles can have any number of dimensional properties like length, width, flange, etc.
*Profiles are categorized (HEA, HEB...) for easier selection by the user in the user interface.
*Available profiles belongs to an internally used class denoted by a (one letter) name.
*Moved the profile handling parts of ArchStructure to a new module ArchProfile. This module reads the datafile, has the, rewritten, makeProfile function and the Profile classes.
* There are python classes that generate the objects needed and the geometrics for each class of profiles.
* I added a new class of profiles UPE (U-class) to test.

Here are the files
(Arc.py is changed with added import ArcProfile to enable use of FreeCADGui.doCommand to make the profile just as in the original version.)

If anyone finds this useful, use it.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Section presets in Arch module

Post by bernd »

I had the same problems you guy have two years ago. I started to use and to contribute to http://www.bolts-library.org/ It is available as Macro_BOLTS and does integrate into FreeCAD very well.

Anyway great to see improvements in the Arch Structures too.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Section presets in Arch module

Post by yorik »

Cool! I'll have a look at this ASAP.
JAndersM
Posts: 63
Joined: Tue Dec 22, 2015 1:35 pm

Re: Section presets in Arch module

Post by JAndersM »

Updated the files with some minor changes and new profile classes:
*All python profile classes are subclasses to _Profile. There is not much in _Profile right now but it might be useful for common profile data (eg. area). Anyway it "feels" better to have a common superclass for the same type of objects.
*New classes for generating rectangular hollow and circular tube profiles.

zip file here
bernd wrote:I had the same problems you guy have two years ago. I started to use and to contribute to http://www.bolts-library.org/ It is available as Macro_BOLTS and does integrate into FreeCAD very well.
BOLTS could be a way to go with profiles. There are an enormous number of profiles out there.
Changing the profile definitions from csv to yaml format would be a start....

Maybe you could have a database with profile data (in BOLTS) that FreeCAD queries rather than having lists data in local files.
Have there been talk about FreeCAD database couplings?

Regarding the (original) module ArcStructure. I have a question:
The Rotate function while creating preset structures. How does it work? Or rather what problem does it solve for the user?
Post Reply