Structure - How to implement profile classes?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Structure - How to implement profile classes?

Post by renatorivo »

It would be useful to implement profile classes with other profiles, L, T, Z, and many others.
I found https://github.com/FreeCAD/FreeCAD/blob ... ofiles.csv

Code: Select all

#Data structure:
#Category, Name, Profile class, geometric data...
#Possible profile classes are: 
#C=Circular tube
#H= H- or I-profile
#R= Rectangular
#RH= Rectangular hollow
#U= U-profile
###########################################
How can I add other classes?
Can I create a custom database of structure profiles?

I tried to implement and then import from PartsLibrary, but it is not satisfactory.

Renato
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Structure - How to implement profile classes?

Post by bernd »

I can't resist to mention BOLTS because it has all this profile already. https://github.com/berndhahnebach/BOLTS ... TS/freecad
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Structure - How to implement profile classes?

Post by renatorivo »

With CHS, RHS and SHS classes I get an error
bolts-errore.png
bolts-errore.png (22.47 KiB) Viewed 2227 times

Edit
It looks like it works properly with
OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.12570 (Git)
Build type: Release
Branch: master
Hash: b01c503c2cb37b2ed4fb848b0f495f599a7b179f
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: Italian/Italy (it_IT)
User avatar
yorik
Founder
Posts: 13630
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Structure - How to implement profile classes?

Post by yorik »

renatorivo wrote: Sun Nov 12, 2017 10:25 pmHow can I add other classes?
Basically you need to add a new function in ArchProfile.py. Then inside ArchProfile.makeProfile, add a new case to use your new function in case of a certain letter ("L" or "Z" etc). Then you just need to populate the csv file with some new presets.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Structure - How to implement profile classes?

Post by bernd »

renatorivo wrote: Mon Nov 13, 2017 11:41 am With CHS, RHS and SHS classes I get an error
bolts-errore.png
Where did you install BOLTS from?
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Structure - How to implement profile classes?

Post by renatorivo »

I've tried in two different ways, same mistake.
The error appears only with FreeCAD0.16. Works well with FreeCAD0.17
bolts1.png
bolts1.png (13.13 KiB) Viewed 2125 times
bolts2.png
bolts2.png (30.95 KiB) Viewed 2125 times
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Structure - How to implement profile classes?

Post by bernd »

thschrader
Veteran
Posts: 3122
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Structure - How to implement profile classes?

Post by thschrader »

bernd wrote: Wed Nov 15, 2017 10:58 am It is a know issue ... https://forum.freecadweb.org/viewtopic. ... 70#p194691
Here is a related issue in arch-wb.
https://forum.freecadweb.org/viewtopic.php?f=3&t=25143
User avatar
Anam
Posts: 39
Joined: Mon Mar 20, 2017 10:22 am
Location: Teramo, Italy

Re: Structure - How to implement profile classes?

Post by Anam »

yorik wrote: Tue Nov 14, 2017 12:14 pm
renatorivo wrote: Sun Nov 12, 2017 10:25 pmHow can I add other classes?
Basically you need to add a new function in ArchProfile.py. Then inside ArchProfile.makeProfile, add a new case to use your new function in case of a certain letter ("L" or "Z" etc). Then you just need to populate the csv file with some new presets.
Hello there, I follow the Yorick's advice and I wrote a script to draw a L profile section with Height H, Base B and thickness s. How can I add a new case whit this script ?

Code: Select all

## L-shaped
import Part
import math
from FreeCAD import Vector
#
#VALUES#
H=30.0   # mm Height
B=20.0   # mm Base
s= 4.0  # mm Thickness
# Coordinate dei punti nel sistema di riferimento con origine il punto 0
p0= Vector(0,0,0)
p1= Vector(s,0,0)
p2= Vector(s,H-s,0)
p3= Vector(B,H-s,0)
p4= Vector(B,H,0)
p5= Vector(0,H,0) 
#p= Part.makePolygon([p0,p1,p2,p3,p4,p5,p0])
#p= Part.Face(p)
#Part.show(p)
# Coordinate dei punti nel sistema di riferimento con origine il baricentro
VG=Vector(-(H*s**2/2+(B-s)*s*(s+(B-s)/2))/((B-s)*s+H*s),-(H**2*s/2+(B-s)*(H-s/2)*s)/((B-s)*s+H*s),0)
P0= p0.add(VG)
P1= p1.add(VG)
P2= p2.add(VG)
P3= p3.add(VG)
P4= p4.add(VG)
P5= p5.add(VG)
P= Part.makePolygon([P0,P1,P2,P3,P4,P5,P0])
P= Part.Face(P)
Part.show(P)
renatorivo
Veteran
Posts: 2611
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Structure - How to implement profile classes?

Post by renatorivo »

I made some changes in the code. They're available in https://forum.freecadweb.org/viewtopic. ... 40#p200479
There is some error in positioning.

Renato
Post Reply