Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Mar 21, 2015
2 parents bd28c52 + 5057f28 commit 05bc4d1
Show file tree
Hide file tree
Showing 19 changed files with 1,617 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/Gui/DownloadManager.cpp
Expand Up @@ -166,6 +166,8 @@ void DownloadManager::download(const QNetworkRequest &request, bool requestFileN
{
if (request.url().isEmpty())
return;

std::cout << request.url().toString().toStdString() << std::endl;

// postpone this reply until we can examine it in replyFinished
QNetworkReply* reply = m_manager->get(request);
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Arch/Arch.py
Expand Up @@ -47,3 +47,4 @@
from ArchPanel import *
from ArchEquipment import *
from ArchCutPlane import *
from ArchServer import *
144 changes: 144 additions & 0 deletions src/Mod/Arch/ArchBuilding.py
Expand Up @@ -34,6 +34,148 @@ def translate(ctxt,txt):
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"

BuildingTypes = ['Undefined',
'Agricultural - Barn',
'Agricultural - Chicken coop or chickenhouse',
'Agricultural - Cow-shed',
'Agricultural - Farmhouse',
'Agricultural - Granary',
'Agricultural - Greenhouse',
'Agricultural - Hayloft',
'Agricultural - Pigpen or sty',
'Agricultural - Root cellar',
'Agricultural - Shed',
'Agricultural - Silo',
'Agricultural - Stable',
'Agricultural - Storm cellar',
'Agricultural - Well house',
'Agricultural - Underground pit',

'Commercial - Automobile repair shop',
'Commercial - Bank',
'Commercial - Car wash',
'Commercial - Convention center',
'Commercial - Forum',
'Commercial - Gas station',
'Commercial - Hotel',
'Commercial - Market',
'Commercial - Market house',
'Commercial - Skyscraper',
'Commercial - Shop',
'Commercial - Shopping mall',
'Commercial - Supermarket',
'Commercial - Warehouse',
'Commercial - Restaurant',

'Residential - Apartment block',
'Residential - Asylum',
'Residential - Condominium',
'Residential - Dormitory',
'Residential - Duplex',
'Residential - House',
'Residential - Nursing home',
'Residential - Townhouse',
'Residential - Villa',
'Residential - Bungalow',

'Educational - Archive',
'Educational - College classroom building',
'Educational - College gymnasium',
'Educational - College students union',
'Educational - School',
'Educational - Library',
'Educational - Museum',
'Educational - Art gallery',
'Educational - Theater',
'Educational - Amphitheater',
'Educational - Concert hall',
'Educational - Cinema',
'Educational - Opera house',
'Educational - Boarding school',

'Government - Capitol',
'Government - City hall',
'Government - Consulate',
'Government - Courthouse',
'Government - Embassy',
'Government - Fire station',
'Government - Meeting house',
'Government - Moot hall',
'Government - Palace',
'Government - Parliament',
'Government - Police station',
'Government - Post office',
'Government - Prison',

'Industrial - Brewery',
'Industrial - Factory',
'Industrial - Foundry',
'Industrial - Power plant',
'Industrial - Mill',

'Military - Arsenal',
'Military -Barracks',

'Parking - Boathouse',
'Parking - Garage',
'Parking - Hangar',

'Storage - Silo',
'Storage - Hangar',

'Religious - Church',
'Religious - Basilica',
'Religious - Cathedral',
'Religious - Chapel',
'Religious - Oratory',
'Religious - Martyrium',
'Religious - Mosque',
'Religious - Mihrab',
'Religious - Surau',
'Religious - Imambargah',
'Religious - Monastery',
'Religious - Mithraeum',
'Religious - Fire temple',
'Religious - Shrine',
'Religious - Synagogue',
'Religious - Temple',
'Religious - Pagoda',
'Religious - Gurdwara',
'Religious - Hindu temple',

'Transport - Airport terminal',
'Transport - Bus station',
'Transport - Metro station',
'Transport - Taxi station',
'Transport - Railway station',
'Transport - Signal box',
'Transport - Lighthouse',

'Infrastructure - Data centre',

'Power station - Fossil-fuel power station',
'Power station - Nuclear power plant',
'Power station - Geothermal power',
'Power station - Biomass-fuelled power plant',
'Power station - Waste heat power plant',
'Power station - Renewable energy power station',
'Power station - Atomic energy plant',

'Other - Apartment',
'Other - Clinic',
'Other - Community hall',
'Other - Eatery',
'Other - Folly',
'Other - Food court',
'Other - Hospice',
'Other - Hospital',
'Other - Hut',
'Other - Bathhouse',
'Other - Workshop',
'Other - World trade centre'
]


def makeBuilding(objectslist=None,baseobj=None,name="Building"):
'''makeBuilding(objectslist): creates a building including the
objects from the given list.'''
Expand Down Expand Up @@ -87,8 +229,10 @@ class _Building(ArchFloor._Floor):
"The Building object"
def __init__(self,obj):
ArchFloor._Floor.__init__(self,obj)
obj.addProperty("App::PropertyEnumeration","BuildingType","Arch",translate("Arch","The type of this building"))
self.Type = "Building"
obj.setEditorMode('Height',2)
obj.BuildingType = BuildingTypes

class _ViewProviderBuilding(ArchFloor._ViewProviderFloor):
"A View Provider for the Building object"
Expand Down
61 changes: 56 additions & 5 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -147,12 +147,14 @@ def __init__(self,vobj):
vobj.addProperty("App::PropertyPercent","Transparency","Base","")
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
vobj.addProperty("App::PropertyColor","LineColor","Base","")
vobj.addProperty("App::PropertyBool","CutView","Arch",translate("Arch","Show the cut in the 3D view"))
vobj.DisplayLength = 1
vobj.DisplayHeight = 1
vobj.ArrowSize = 1
vobj.Transparency = 85
vobj.LineWidth = 1
vobj.LineColor = (0.0,0.0,0.4,1.0)
vobj.CutView = False
vobj.Proxy = self
self.Object = vobj.Object

Expand All @@ -164,6 +166,7 @@ def claimChildren(self):
return []

def attach(self,vobj):
self.clip = None
self.mat1 = coin.SoMaterial()
self.mat2 = coin.SoMaterial()
self.fcoords = coin.SoCoordinate3()
Expand Down Expand Up @@ -191,6 +194,7 @@ def attach(self,vobj):
self.onChanged(vobj,"DisplayLength")
self.onChanged(vobj,"LineColor")
self.onChanged(vobj,"Transparency")
self.onChanged(vobj,"CutView")

def getDisplayModes(self,vobj):
return ["Default"]
Expand All @@ -204,6 +208,7 @@ def setDisplayMode(self,mode):
def updateData(self,obj,prop):
if prop in ["Placement"]:
self.onChanged(obj.ViewObject,"DisplayLength")
self.onChanged(obj.ViewObject,"CutView")
return

def onChanged(self,vobj,prop):
Expand Down Expand Up @@ -249,6 +254,31 @@ def onChanged(self,vobj,prop):
self.fcoords.point.setValues(fverts)
elif prop == "LineWidth":
self.drawstyle.lineWidth = vobj.LineWidth
elif prop == "CutView":
if hasattr(vobj,"CutView") and FreeCADGui.ActiveDocument.ActiveView:
sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
if vobj.CutView:
if self.clip:
sg.removeChild(self.clip)
self.clip = None
else:
for o in Draft.getGroupContents(vobj.Object.Objects,walls=True):
if hasattr(o.ViewObject,"Lighting"):
o.ViewObject.Lighting = "One side"
self.clip = coin.SoClipPlane()
self.clip.on.setValue(True)
norm = vobj.Object.Proxy.getNormal(vobj.Object)
mp = vobj.Object.Shape.CenterOfMass
mp = DraftVecUtils.project(mp,norm)
dist = mp.Length + 0.1 # to not clip exactly on the section object
norm = norm.negative()
plane = coin.SbPlane(coin.SbVec3f(norm.x,norm.y,norm.z),-dist)
self.clip.plane.setValue(plane)
sg.insertChild(self.clip,0)
else:
if self.clip:
sg.removeChild(self.clip)
self.clip = None
return

def __getstate__(self):
Expand All @@ -262,6 +292,7 @@ def __init__(self, obj):
obj.addProperty("App::PropertyLink","Source","Base","The linked object")
obj.addProperty("App::PropertyEnumeration","RenderingMode","Drawing view","The rendering mode to use")
obj.addProperty("App::PropertyBool","ShowCut","Drawing view","If cut geometry is shown or not")
obj.addProperty("App::PropertyBool","ShowFill","Drawing view","If cut geometry is filled or not")
obj.addProperty("App::PropertyFloat","LineWidth","Drawing view","The line width of the rendered objects")
obj.addProperty("App::PropertyLength","FontSize","Drawing view","The size of the texts inside this object")
obj.RenderingMode = ["Solid","Wireframe"]
Expand Down Expand Up @@ -378,12 +409,17 @@ def onChanged(self, obj, prop):
c = sol.cut(cutvolume)
s = sol.section(cutface)
try:
s = Part.Wire(s.Edges)
s = Part.Face(s)
wires = DraftGeomUtils.findWires(s.Edges)
for w in wires:
f = Part.Face(w)
sshapes.append(f)
#s = Part.Wire(s.Edges)
#s = Part.Face(s)
except Part.OCCError:
pass
#print "ArchDrawingView: unable to get a face"
sshapes.append(s)
nsh.extend(c.Solids)
sshapes.append(s)
#sshapes.append(s)
if hasattr(obj,"ShowCut"):
if obj.ShowCut:
c = sol.cut(invcutvolume)
Expand All @@ -409,13 +445,28 @@ def onChanged(self, obj, prop):
svgh = svgh.replace('fill="none"','fill="none"\nstroke-dasharray="DAPlaceholder"')
self.svg += svgh
if sshapes:
svgs = ""
if hasattr(obj,"ShowFill"):
if obj.ShowFill:
svgs += '<g transform="rotate(180)">\n'
svgs += '<pattern id="sectionfill" patternUnits="userSpaceOnUse" patternTransform="matrix(5,0,0,5,0,0)"'
svgs += ' x="0" y="0" width="10" height="10">'
svgs += '<g style="fill:none; stroke:#000000; stroke-width:1">'
svgs += '<path d="M0,0 l10,10" /></g></pattern>'
for s in sshapes:
if s.Edges:
f = Draft.getSVG(s,direction=self.direction.negative(),linewidth=0,fillstyle="sectionfill",color=(0,0,0))
svgs += f
svgs += "</g>\n"
sshapes = Part.makeCompound(sshapes)
self.sectionshape = sshapes
svgs = Drawing.projectToSVG(sshapes,self.direction)
svgs += Drawing.projectToSVG(sshapes,self.direction)
if svgs:
svgs = svgs.replace('stroke-width="0.35"','stroke-width="SWPlaceholder"')
svgs = svgs.replace('stroke-width="1"','stroke-width="SWPlaceholder"')
svgs = svgs.replace('stroke-width:0.01','stroke-width:SWPlaceholder')
svgs = svgs.replace('stroke-width="0.35 px"','stroke-width="SWPlaceholder"')
svgs = svgs.replace('stroke-width:0.35','stroke-width:SWPlaceholder')
self.svg += svgs

def __getstate__(self):
Expand Down

0 comments on commit 05bc4d1

Please sign in to comment.