# -*- coding: utf-8 -*-

# Gehäuse für Fräse

# Der Ursprung der 3D-Darstellung ist die rechte untere Ecke des unteren Profils.

# Macro Begin
import FreeCAD
from FreeCAD import Placement, Rotation, Vector
#import Part
#import Draft
import matplotlib

doc=FreeCAD.newDocument(u"Gehäuse für Fräse")

# Definitionen
I_Len = 1400                    # Länge innen
I_Width = 900                   # Breite innen
I_Height = 600                  # Höhe innen
H_Height = 200                  # Höhe Haube innen
P_Width = 20                    # Kantenlänge des Profils
L20x20 = 0                      # Gesamtlänge des 20x20 Profils
L20x40 = 0                      # Gesamtlänge des 20x40 Profils
VolAcryl = 0                    # Volumen der Acrylscheiben
WCount = 0                      # Anzahl der Würfel
WD = 2                          # Dicke der vertikalen Acrylscheiben
WDH = 3                         # Dicke der oberen horizontalen Acrylscheiben für die Haube
WNutPG = 3                      # Überlänge der Wand für Nuten mit Profilgummi
WNutO = 5                       # Überlänge der Wand für die Nuten ohne Profilgummi
BA = 2                          # Bodenabstand der verschiebbaren Scheibe
UL = 50                         # Überlänge der herausnehmbaren Scheiben vorne und hinten

# Settings zum Debuggen, ansonsten alles auf True!
Show_Haube = True               # Zeige die Haube
Show_Korpus = True              # Zeige den Korpus
Show_AcrylKorpus = True         # Zeige die Acrylscheiben des Korpus
Show_AcrylHaube = True          # Zeige die Acrylscheiben der Haube
Horizontal_Profile = True       # Horizontales Profil generieren
Vertical_Profile = True         # Vertikales Profil generieren
Alle_Wuerfel = True             # Alle Würfel generieren

vec0=Vector(0,0,0)      # Nullvektor
vecx=Vector(1,0,0)      # Drehachse x
vecy=Vector(0,1,0)      # Drehachse y
vecz=Vector(0,0,1)      # Drehachse z

# Farben
Farbe_Profil_Korpus     = matplotlib.colors.to_rgb('royalblue')
Farbe_Profil_Haube      = matplotlib.colors.to_rgb('lightsteelblue')
Farbe_AcrylKorpus       = matplotlib.colors.to_rgb('whitesmoke')
Farbe_AcrylHaube        = matplotlib.colors.to_rgb('lightcyan')

def MakeProfil20x20(length):
# Profil, 20mm Kantenlänge
   print("Profil 20 x 20",length,"mm")
   global L20x20
   S1 = Part.Shape([
   Part.LineSegment(Vector( -10, -10, 0), Vector(  -3, -10, 0)),
   Part.LineSegment(Vector(  -3, -10, 0), Vector(  -3,  -5, 0)),
   Part.LineSegment(Vector(  -3,  -5, 0), Vector(   3,  -5, 0)),
   Part.LineSegment(Vector(   3,  -5, 0), Vector(   3, -10, 0)),
   Part.LineSegment(Vector(   3, -10, 0), Vector(  10, -10, 0)),

   Part.LineSegment(Vector(  10, -10, 0), Vector(  10,  -3, 0)),
   Part.LineSegment(Vector(  10,  -3, 0), Vector(   5,  -3, 0)),
   Part.LineSegment(Vector(   5,  -3, 0), Vector(   5,   3, 0)),
   Part.LineSegment(Vector(   5,   3, 0), Vector(  10,   3, 0)),
   Part.LineSegment(Vector(  10,   3, 0), Vector(  10,  10, 0)),

   Part.LineSegment(Vector(  10,  10, 0), Vector(   3,  10, 0)),
   Part.LineSegment(Vector(   3,  10, 0), Vector(   3,   5, 0)),
   Part.LineSegment(Vector(   3,   5, 0), Vector(  -3,   5, 0)),
   Part.LineSegment(Vector(  -3,   5, 0), Vector(  -3,  10, 0)),
   Part.LineSegment(Vector(  -3,  10, 0), Vector( -10,  10, 0)),

   Part.LineSegment(Vector( -10,  10, 0), Vector( -10,   3, 0)),
   Part.LineSegment(Vector( -10,   3, 0), Vector(  -5,   3, 0)),
   Part.LineSegment(Vector(  -5,   3, 0), Vector(  -5,  -3, 0)),
   Part.LineSegment(Vector(  -5,  -3, 0), Vector( -10,  -3, 0)),
   Part.LineSegment(Vector( -10,  -3, 0), Vector( -10, -10, 0)),
   ])

   Profil = Part.Face(Part.Wire(S1.Edges)).extrude(Vector(0, 0, length))
   L20x20 = L20x20 + length

   return(Profil)

def MakeProfil20x40(length):
# Profil, 20mm x 40mm Kantenlänge
   print("Profil 20 x 40",length,"mm")
   global L20x40
   S1 = Part.Shape([
   Part.LineSegment(Vector( -30, -10, 0), Vector( -23, -10, 0)),
   Part.LineSegment(Vector( -23, -10, 0), Vector( -23,  -5, 0)),
   Part.LineSegment(Vector( -23,  -5, 0), Vector( -17,  -5, 0)),
   Part.LineSegment(Vector( -17,  -5, 0), Vector( -17, -10, 0)),
   Part.LineSegment(Vector( -17, -10, 0), Vector(  -3, -10, 0)),

   Part.LineSegment(Vector(  -3, -10, 0), Vector(  -3,  -5, 0)),
   Part.LineSegment(Vector(  -3,  -5, 0), Vector(   3,  -5, 0)),
   Part.LineSegment(Vector(   3,  -5, 0), Vector(   3, -10, 0)),
   Part.LineSegment(Vector(   3, -10, 0), Vector(  10, -10, 0)),

   Part.LineSegment(Vector(  10, -10, 0), Vector(  10,  -3, 0)),
   Part.LineSegment(Vector(  10,  -3, 0), Vector(   5,  -3, 0)),
   Part.LineSegment(Vector(   5,  -3, 0), Vector(   5,   3, 0)),
   Part.LineSegment(Vector(   5,   3, 0), Vector(  10,   3, 0)),
   Part.LineSegment(Vector(  10,   3, 0), Vector(  10,  10, 0)),

   Part.LineSegment(Vector(  10,  10, 0), Vector(   3,  10, 0)),
   Part.LineSegment(Vector(   3,  10, 0), Vector(   3,   5, 0)),
   Part.LineSegment(Vector(   3,   5, 0), Vector(  -3,   5, 0)),
   Part.LineSegment(Vector(  -3,   5, 0), Vector(  -3,  10, 0)),
   Part.LineSegment(Vector(  -3,  10, 0), Vector( -17,  10, 0)),

   Part.LineSegment(Vector( -17,  10, 0), Vector( -17,   5, 0)),
   Part.LineSegment(Vector( -17,   5, 0), Vector( -23,   5, 0)),
   Part.LineSegment(Vector( -23,   5, 0), Vector( -23,  10, 0)),
   Part.LineSegment(Vector( -23,  10, 0), Vector( -30,  10, 0)),

   Part.LineSegment(Vector( -30,  10, 0), Vector( -30,   3, 0)),
   Part.LineSegment(Vector( -30,   3, 0), Vector( -25,   3, 0)),
   Part.LineSegment(Vector( -25,   3, 0), Vector( -25,  -3, 0)),
   Part.LineSegment(Vector( -25,  -3, 0), Vector( -30,  -3, 0)),
   Part.LineSegment(Vector( -30,  -3, 0), Vector( -30, -10, 0)),
   ])

   Profil = Part.Face(Part.Wire(S1.Edges)).extrude(Vector(0, 0, length))
   L20x40 = L20x40 + length

   return(Profil)

def Wuerfel20x20():
# Würfelverbinder, 20mm Kantenlänge
   global WCount
   Wuerfel = Part.makeBox(P_Width, P_Width, P_Width)
   Wuerfel = Wuerfel.cut(Part.makeCylinder(5, P_Width).translate(Vector(P_Width/2,P_Width/2,0)))
   Wuerfel = Wuerfel.cut(Part.makeCylinder(5, P_Width).rotate(vec0,vecy,  90).translate(Vector(0,P_Width/2,P_Width/2)))
   Wuerfel = Wuerfel.cut(Part.makeCylinder(5, P_Width).rotate(vec0,vecx, -90).translate(Vector(P_Width/2,0,P_Width/2)))
   WCount = WCount + 1

   return(Wuerfel)

def MakeWall(dim_x, dim_y, dim_z):
# Plexiglasscheibe
   global VolAcryl
   acryl = Part.makeBox(dim_x, dim_y, dim_z).translate(Vector(0, -dim_y/2, 0))
   VolAcryl = VolAcryl + dim_x * dim_y * dim_z
   print("Acrylscheibe,", dim_y, "mm dick,", dim_x, "mm x", dim_z, "mm")

   return(acryl)

print("\n\nGeneriere den Korpus:")
Korpus = Part.makeBox(1, 1, 1)
# Generiere Rahmen Korpus unten
if Horizontal_Profile:
   Korpus =             MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           P_Width/2,           P_Width/2))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           I_Width+3*P_Width/2, P_Width/2)))
   Korpus = Korpus.fuse(MakeProfil20x40(I_Width).rotate(vec0,vecx, -90).translate(Vector(1*P_Width/2,       P_Width,             P_Width/2)))
   Korpus = Korpus.fuse(MakeProfil20x40(I_Width).rotate(vec0,vecx, -90).translate(Vector(I_Len+5*P_Width/2, P_Width,             P_Width/2)))

# Generiere Rahmen Korpus oben
   Korpus = Korpus.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           P_Width/2,           I_Height+3*P_Width/2)))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           I_Width+3*P_Width/2, I_Height+3*P_Width/2)))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(1*P_Width/2,       P_Width,             I_Height+3*P_Width/2)))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(I_Len+3*P_Width/2, P_Width,             I_Height+3*P_Width/2)))

# Generiere Rahmen Korpus senkrecht
if Vertical_Profile:
   Korpus = Korpus.fuse(MakeProfil20x40(I_Height).translate(Vector(        1*P_Width/2, P_Width/2,           P_Width)))
   Korpus = Korpus.fuse(MakeProfil20x40(I_Height).translate(Vector(        1*P_Width/2, I_Width+3*P_Width/2, P_Width)))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Height).translate(Vector(I_Len/2+2*P_Width/2, P_Width/2,           P_Width)))
   Korpus = Korpus.fuse(MakeProfil20x20(I_Height).translate(Vector(I_Len/2+2*P_Width/2, I_Width+3*P_Width/2, P_Width)))
   Korpus = Korpus.fuse(MakeProfil20x40(I_Height).translate(Vector(I_Len+  5*P_Width/2, P_Width/2,           P_Width)))
   Korpus = Korpus.fuse(MakeProfil20x40(I_Height).translate(Vector(I_Len+  5*P_Width/2, I_Width+3*P_Width/2, P_Width)))

# Generiere Würfel
if Alle_Wuerfel:
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(0, 0, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(0, I_Width+P_Width, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, 0, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, I_Width+P_Width, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(-P_Width, 0, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(-P_Width, I_Width+P_Width, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+2*P_Width, 0, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+2*P_Width, I_Width+P_Width, 0)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(0, 0, I_Height+2*P_Width/2)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(0, I_Width+P_Width, I_Height+2*P_Width/2)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, 0, I_Height+2*P_Width/2)))
   Korpus = Korpus.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, I_Width+P_Width, I_Height+2*P_Width/2)))

# Scheiben für Korpus erzeugen
AcrylKorpus =                   MakeWall(I_Len/2+3*P_Width/2-BA,       WD, I_Height+2*P_Width).translate(                     Vector(                         0,               -WD/2, BA)) # verschiebbare Scheibe
AcrylKorpus =  AcrylKorpus.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+I_Height).translate(                      Vector(        2*P_Width/2-WNutPG, I_Width+3*P_Width/2, P_Width-WNutPG)))
AcrylKorpus =  AcrylKorpus.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+I_Height).translate(                      Vector(I_Len/2+3*P_Width/2-WNutPG, P_Width/2,           P_Width-WNutPG)))
AcrylKorpus =  AcrylKorpus.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+I_Height).translate(                      Vector(I_Len/2+3*P_Width/2-WNutPG, I_Width+3*P_Width/2, P_Width-WNutPG)))
AcrylKorpus =  AcrylKorpus.fuse(MakeWall(2*WNutO+I_Width,              WD, 1*WNutO+I_Height+UL).rotate(vec0,vecz, 90).translate(Vector(-1*P_Width/2,                P_Width-WNutO,       P_Width-WNutO)))
AcrylKorpus =  AcrylKorpus.fuse(MakeWall(2*WNutO+I_Width,              WD, 1*WNutO+I_Height+UL).rotate(vec0,vecz, 90).translate(Vector(I_Len+ 5*P_Width/2,          P_Width-WNutO,       P_Width-WNutO)))

Gewicht_Acryl = 1.19*VolAcryl/1000000
Gewicht_20x20 = L20x20*0.44/1000
Gewicht_20x40 = L20x40*0.9/1000
print ("Gesamtlaenge Profil 20x20 fuer Korpus:", L20x20/1000, "m, Gewicht:", Gewicht_20x20, "kg")
print ("Gesamtlaenge Profil 20x40 fuer Korpus:", L20x40/1000, "m, Gewicht:", Gewicht_20x40, "kg")
print ("Acryl fuer Korpus:", VolAcryl/1000, "cm*cm*cm =", Gewicht_Acryl, "kg")
print ("Gesamtgewicht Korpus:", Gewicht_Acryl+Gewicht_20x20+Gewicht_20x40, "kg")

L20x20 = 0
L20x40 = 0
VolAcryl = 0

print("\n\nGeneriere die Haube:")
Haube = Part.makeBox(1, 1, 1)
# Generiere Rahmen für Haube unten
if Horizontal_Profile:
   Haube =            MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           P_Width/2,           P_Width/2))
   Haube = Haube.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(P_Width,           I_Width+3*P_Width/2, P_Width/2)))
   Haube = Haube.fuse(MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(1*P_Width/2,       P_Width,             P_Width/2)))
   Haube = Haube.fuse(MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(I_Len+3*P_Width/2, P_Width,             P_Width/2)))

# Generiere Rahmen für Haube oben
   Haube = Haube.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(              P_Width, P_Width/2,           H_Height+3*P_Width/2)))
   Haube = Haube.fuse(MakeProfil20x20(I_Len  ).rotate(vec0,vecy,  90).translate(Vector(              P_Width, I_Width+3*P_Width/2, H_Height+3*P_Width/2)))
Haube = Haube.fuse(   MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(          2*P_Width/4, P_Width,             H_Height+3*P_Width/2)))
Haube = Haube.fuse(   MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(1*I_Len/4+3*P_Width/4, P_Width,             H_Height+3*P_Width/2)))
Haube = Haube.fuse(   MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(2*I_Len/4+4*P_Width/4, P_Width,             H_Height+3*P_Width/2)))
Haube = Haube.fuse(   MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(3*I_Len/4+5*P_Width/4, P_Width,             H_Height+3*P_Width/2)))
Haube = Haube.fuse(   MakeProfil20x20(I_Width).rotate(vec0,vecx, -90).translate(Vector(I_Len+3*P_Width/2,     P_Width,             H_Height+3*P_Width/2)))

# Generiere Rahmen für Haube senkrecht
if Vertical_Profile:
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(        1*P_Width/2, P_Width/2,           P_Width)))
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(        1*P_Width/2, I_Width+3*P_Width/2, P_Width)))
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(I_Len/2+2*P_Width/2, P_Width/2,           P_Width)))
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(I_Len/2+2*P_Width/2, I_Width+3*P_Width/2, P_Width)))
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(I_Len+  3*P_Width/2, P_Width/2,           P_Width)))
   Haube = Haube.fuse(MakeProfil20x20(H_Height).translate(Vector(I_Len+  3*P_Width/2, I_Width+3*P_Width/2, P_Width)))

# Generiere Würfel
if Alle_Wuerfel:
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(0, 0, 0)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(0, I_Width+P_Width, 0)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, 0, 0)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, I_Width+P_Width, 0)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(0,                           0, H_Height+2*P_Width/2)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(0,             I_Width+P_Width, H_Height+2*P_Width/2)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width,               0, H_Height+2*P_Width/2)))
   Haube = Haube.fuse(Wuerfel20x20().translate(Vector(I_Len+P_Width, I_Width+P_Width, H_Height+2*P_Width/2)))

# Vertikale Scheiben für die Haube erzeugen
AcrylHaube =                 MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+H_Height).translate(                      Vector(        2*P_Width/2-WNutPG, P_Width/2,           P_Width-WNutPG))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+H_Height).translate(                      Vector(        2*P_Width/2-WNutPG, I_Width+3*P_Width/2, P_Width-WNutPG)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+H_Height).translate(                      Vector(I_Len/2+3*P_Width/2-WNutPG, P_Width/2,           P_Width-WNutPG)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Len/2-1*P_Width/2, WD, 2*WNutPG+H_Height).translate(                      Vector(I_Len/2+3*P_Width/2-WNutPG, I_Width+3*P_Width/2, P_Width-WNutPG)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width,             WD, 2*WNutPG+H_Height).rotate(vec0,vecz, 90).translate(Vector(1*P_Width/2,              P_Width-WNutPG,        P_Width-WNutPG)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width,             WD, 2*WNutPG+H_Height).rotate(vec0,vecz, 90).translate(Vector(I_Len+ 3*P_Width/2,       P_Width-WNutPG,        P_Width-WNutPG)))

# Horizontale Scheiben für die Haube erzeugen, Abdeckung
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width, WDH, 2*WNutPG+I_Len/4-3*P_Width/4).rotate(vec0,vecz, 90).rotate(vec0,vecy, 90).translate(Vector(P_Width-WNutPG, P_Width-WNutPG, H_Height+3*P_Width/2)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width, WDH, 2*WNutPG+I_Len/4-3*P_Width/4).rotate(vec0,vecz, 90).rotate(vec0,vecy, 90).translate(Vector(1*(I_Len+P_Width)/4+P_Width-WNutPG, P_Width-WNutPG, H_Height+3*P_Width/2)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width, WDH, 2*WNutPG+I_Len/4-3*P_Width/4).rotate(vec0,vecz, 90).rotate(vec0,vecy, 90).translate(Vector(2*(I_Len+P_Width)/4+P_Width-WNutPG, P_Width-WNutPG, H_Height+3*P_Width/2)))
AcrylHaube = AcrylHaube.fuse(MakeWall(2*WNutPG+I_Width, WDH, 2*WNutPG+I_Len/4-3*P_Width/4).rotate(vec0,vecz, 90).rotate(vec0,vecy, 90).translate(Vector(3*(I_Len+P_Width)/4+P_Width-WNutPG, P_Width-WNutPG, H_Height+3*P_Width/2)))

Haube = Haube.translate(Vector(0, 0, I_Height+2*P_Width))
AcrylHaube = AcrylHaube.translate(Vector(0, 0, I_Height+2*P_Width))

# Namen und Farben zuweisen
if Show_Korpus:
   p1=doc.addObject("Part::Feature")
   p1.Shape = Korpus
   p1.ViewObject.ShapeColor=Farbe_Profil_Korpus
   p1.Label="Profil Korpus"

if Show_Haube:
   p1=doc.addObject("Part::Feature")
   p1.Shape = Haube
   p1.ViewObject.ShapeColor=Farbe_Profil_Haube
   p1.Label="Profil Haube"

if Show_AcrylKorpus:
   p1=doc.addObject("Part::Feature")
   p1.Shape = AcrylKorpus
   p1.ViewObject.ShapeColor=Farbe_AcrylKorpus
   p1.ViewObject.Transparency = 90
   p1.Label="Acrylwände Korpus"

if Show_AcrylHaube:
   p1=doc.addObject("Part::Feature")
   p1.Shape = AcrylHaube
   p1.ViewObject.ShapeColor=Farbe_AcrylHaube
   p1.ViewObject.Transparency = 90
   p1.Label="Acrylwände Haube"

Gewicht_Acryl = 1.19*VolAcryl/1000000
Gewicht_20x20 = L20x20*0.44/1000
Gewicht_20x40 = L20x40*0.9/1000
print ("Gesamtlaenge Profil 20x20 Haube:", L20x20/1000, "m, Gewicht:", Gewicht_20x20, "kg")
print ("Gesamtlaenge Profil 20x40 Haube:", L20x40/1000, "m, Gewicht:", Gewicht_20x40, "kg")
print ("Gesamtgewicht der Profile fuer die Haube:", Gewicht_20x20+Gewicht_20x40, "kg")
print ("Acryl fuer Haube:", VolAcryl/1000, "cm*cm*cm =", Gewicht_Acryl, "kg")
print ("Gesamtgewicht der Haube:", Gewicht_Acryl+Gewicht_20x20+Gewicht_20x40, "kg")
print (WCount, u"Würfel")

view = FreeCADGui.ActiveDocument.ActiveView
view.fitAll()

# Macro End

