Structure - How to implement profile classes?

A forum dedicated to the Draft, Arch and BIM workbenches development.
renatorivo
Posts: 2378
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Structure - How to implement profile classes?

Postby renatorivo » Sun Nov 12, 2017 10:25 pm

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
Posts: 9301
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Structure - How to implement profile classes?

Postby bernd » Sun Nov 12, 2017 11:35 pm

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

Re: Structure - How to implement profile classes?

Postby renatorivo » Mon Nov 13, 2017 11:41 am

With CHS, RHS and SHS classes I get an error
bolts-errore.png
bolts-errore.png (22.47 KiB) Viewed 1119 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
Site Admin
Posts: 11700
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Structure - How to implement profile classes?

Postby yorik » Tue Nov 14, 2017 12:14 pm

renatorivo wrote:
Sun Nov 12, 2017 10:25 pm
How 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
Posts: 9301
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Structure - How to implement profile classes?

Postby bernd » Wed Nov 15, 2017 8:28 am

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
Posts: 2378
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Structure - How to implement profile classes?

Postby renatorivo » Wed Nov 15, 2017 9:41 am

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 1017 times
bolts2.png
bolts2.png (30.95 KiB) Viewed 1017 times
User avatar
bernd
Posts: 9301
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Structure - How to implement profile classes?

Postby bernd » Wed Nov 15, 2017 10:58 am

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

Re: Structure - How to implement profile classes?

Postby thschrader » Wed Nov 15, 2017 1:50 pm

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?

Postby Anam » Mon Nov 20, 2017 7:32 pm

yorik wrote:
Tue Nov 14, 2017 12:14 pm
renatorivo wrote:
Sun Nov 12, 2017 10:25 pm
How 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
Posts: 2378
Joined: Tue Feb 21, 2012 8:07 pm
Location: Torino - Italy

Re: Structure - How to implement profile classes?

Postby renatorivo » Tue Nov 21, 2017 6:08 pm

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