Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2015-03-21 16:57:36 +01:00
commit 05bc4d13e1
19 changed files with 1617 additions and 21 deletions

View File

@ -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);

View File

@ -47,3 +47,4 @@ from ArchFrame import *
from ArchPanel import *
from ArchEquipment import *
from ArchCutPlane import *
from ArchServer import *

View File

@ -34,6 +34,148 @@ __title__="FreeCAD Building"
__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.'''
@ -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"

View File

@ -147,12 +147,14 @@ class _ViewProviderSectionPlane:
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
@ -164,6 +166,7 @@ class _ViewProviderSectionPlane:
return []
def attach(self,vobj):
self.clip = None
self.mat1 = coin.SoMaterial()
self.mat2 = coin.SoMaterial()
self.fcoords = coin.SoCoordinate3()
@ -191,6 +194,7 @@ class _ViewProviderSectionPlane:
self.onChanged(vobj,"DisplayLength")
self.onChanged(vobj,"LineColor")
self.onChanged(vobj,"Transparency")
self.onChanged(vobj,"CutView")
def getDisplayModes(self,vobj):
return ["Default"]
@ -204,6 +208,7 @@ class _ViewProviderSectionPlane:
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):
@ -249,6 +254,31 @@ class _ViewProviderSectionPlane:
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):
@ -262,6 +292,7 @@ class _ArchDrawingView:
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"]
@ -378,12 +409,17 @@ class _ArchDrawingView:
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)
@ -409,13 +445,28 @@ class _ArchDrawingView:
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):

163
src/Mod/Arch/ArchServer.py Normal file
View File

@ -0,0 +1,163 @@
#***************************************************************************
#* *
#* Copyright (c) 2015 *
#* Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
import FreeCAD,os
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
else:
def translate(ctxt,txt):
return txt
__title__="FreeCAD Arch Server commands"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
class _CommandBimserver:
"the Arch Bimserver command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_Bimserver',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Bimserver","BIM server"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Bimserver","Opens a browser window and connects to a BIM server instance")}
def Activated(self):
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
url = p.GetString("BimServerUrl","http://localhost:8082")
FreeCADGui.addModule("WebGui")
FreeCADGui.doCommand("WebGui.openBrowser(\""+url+"\")")
class _CommandGit:
"the Arch Git Commit command definition"
def GetResources(self):
return {'Pixmap' : 'Git',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Git","Commit with Git"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Git","Commits the current document")}
def Activated(self):
f = FreeCAD.ActiveDocument.FileName
if not f:
FreeCAD.Console.PrintError(translate("Arch","This document is not saved. Please save it first"))
return
try:
import git
except:
FreeCAD.Console.PrintError(translate("Arch","The Python Git module was not found. Please install the python-git package."))
return
try:
repo = git.Repo(os.path.dirname(f))
except:
FreeCAD.Console.PrintError(translate("Arch","This document doesn't appear to be part of a Git repository."))
return
pushOK = True
if not repo.remotes:
FreeCAD.Console.PrintWarning(translate("Arch","Warning: no remote repositories. Unable to push"))
pushOK = False
modified_files = repo.git.diff("--name-only").split()
untracked_files = repo.git.ls_files("--other","--exclude-standard").split()
if not os.path.basename(f) in modified_files:
if not os.path.basename(f) in untracked_files:
FreeCAD.Console.PrintError(translate("Arch","The Git repository cannot handle this document."))
return
d = _ArchGitDialog()
if not pushOK:
d.checkBox.setChecked(False)
d.checkBox.setEnabled(False)
d.label.setText(str(len(modified_files)+len(untracked_files))+" modified file(s)")
d.lineEdit.setText("Changed " + os.path.basename(f))
r = d.exec_()
if r:
if d.radioButton_2.isChecked():
for o in modified_files + untracked_files:
repo.git.add(o)
else:
repo.git.add(os.path.basename(f))
repo.git.commit(m=d.lineEdit.text())
if d.checkBox.isChecked():
repo.git.push()
class _ArchGitDialog(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.setObjectName("ArchGitOptions")
self.resize(370, 200)
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.groupBox = QtGui.QGroupBox(self)
self.groupBox.setObjectName("groupBox")
self.vl3 = QtGui.QVBoxLayout(self.groupBox)
self.vl3.setObjectName("vl3")
self.label = QtGui.QLabel(self.groupBox)
self.label.setObjectName("label")
self.vl3.addWidget(self.label)
self.horizontalLayout = QtGui.QHBoxLayout(self.vl3)
self.horizontalLayout.setObjectName("horizontalLayout")
self.radioButton_2 = QtGui.QRadioButton(self.groupBox)
self.radioButton_2.setChecked(True)
self.radioButton_2.setObjectName("radioButton_2")
self.horizontalLayout.addWidget(self.radioButton_2)
self.radioButton = QtGui.QRadioButton(self.groupBox)
self.radioButton.setObjectName("radioButton")
self.horizontalLayout.addWidget(self.radioButton)
self.verticalLayout.addWidget(self.groupBox)
self.groupBox_2 = QtGui.QGroupBox(self)
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox_2)
self.verticalLayout_2.setObjectName("horizontalLayout_2")
self.lineEdit = QtGui.QLineEdit(self.groupBox_2)
self.lineEdit.setObjectName("lineEdit")
self.verticalLayout_2.addWidget(self.lineEdit)
self.checkBox = QtGui.QCheckBox(self.groupBox_2)
self.checkBox.setChecked(True)
self.checkBox.setObjectName("checkBox")
self.verticalLayout_2.addWidget(self.checkBox)
self.verticalLayout.addWidget(self.groupBox_2)
self.buttonBox = QtGui.QDialogButtonBox(self)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi()
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
QtCore.QMetaObject.connectSlotsByName(self)
def retranslateUi(self):
self.setWindowTitle(QtGui.QApplication.translate("ArchGitOptions", "Git Options", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox.setTitle(QtGui.QApplication.translate("ArchGitOptions", "What to commit", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton_2.setText(QtGui.QApplication.translate("ArchGitOptions", "All files in folder", None, QtGui.QApplication.UnicodeUTF8))
self.radioButton.setText(QtGui.QApplication.translate("ArchGitOptions", "Only this .FcStd file", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_2.setTitle(QtGui.QApplication.translate("ArchGitOptions", "Commit message", None, QtGui.QApplication.UnicodeUTF8))
self.lineEdit.setText(QtGui.QApplication.translate("ArchGitOptions", "commit", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox.setText(QtGui.QApplication.translate("ArchGitOptions", "Push to default remote repository", None, QtGui.QApplication.UnicodeUTF8))
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_Bimserver',_CommandBimserver())
FreeCADGui.addCommand('Arch_Git',_CommandGit())

View File

@ -93,7 +93,10 @@ class _Site(ArchFloor._Floor):
def __init__(self,obj):
ArchFloor._Floor.__init__(self,obj)
obj.addProperty("App::PropertyLink","Terrain","Arch",translate("Arch","The terrain of this site"))
obj.addProperty("App::PropertyString","Address","Arch",translate("Arch","The address of this site"))
obj.addProperty("App::PropertyString","Address","Arch",translate("Arch","The street and housenumber of this site"))
obj.addProperty("App::PropertyString","PostalCode","Arch",translate("Arch","The postal or zip code of this site"))
obj.addProperty("App::PropertyString","City","Arch",translate("Arch","The city of this site"))
obj.addProperty("App::PropertyString","Country","Arch",translate("Arch","The country of this site"))
obj.addProperty("App::PropertyString","Coordinates","Arch",translate("Arch","The geographic coordinates of this site"))
obj.addProperty("App::PropertyString","Url","Arch",translate("Arch","An url that shows this site in a mapping website"))
self.Type = "Site"

View File

@ -29,6 +29,118 @@ __url__ = "http://www.freecadweb.org"
Roles = ["Space"]
SpaceTypes = [
"Undefined",
"Exterior",
"Exterior - Terrace",
"Office",
"Office - Enclosed",
"Office - Open Plan",
"Conference / Meeting / Multipurpose",
"Classroom / Lecture / Training For Penitentiary",
"Lobby",
"Lobby - For Hotel",
"Lobby - For Performing Arts Theater",
"Lobby - For Motion Picture Theater",
"Audience/Seating Area",
"Audience/Seating Area - For Gymnasium",
"Audience/Seating Area - For Exercise Center",
"Audience/Seating Area - For Convention Center",
"Audience/Seating Area - For Penitentiary",
"Audience/Seating Area - For Religious Buildings",
"Audience/Seating Area - For Sports Arena",
"Audience/Seating Area - For Performing Arts Theater",
"Audience/Seating Area - For Motion Picture Theater",
"Audience/Seating Area - For Transportation",
"Atrium",
"Atrium - First Three Floors",
"Atrium - Each Additional Floor",
"Lounge / Recreation",
"Lounge / Recreation - For Hospital",
"Dining Area",
"Dining Area - For Penitentiary",
"Dining Area - For Hotel",
"Dining Area - For Motel",
"Dining Area - For Bar Lounge/Leisure Dining",
"Dining Area - For Family Dining",
"Food Preparation",
"Laboratory",
"Restrooms",
"Dressing / Locker / Fitting",
"Room",
"Corridor / Transition",
"Corridor / Transition - For Hospital",
"Corridor / Transition - For Manufacturing Facility",
"Stairs",
"Active Storage",
"Active Storage - For Hospital",
"Inactive Storage",
"Inactive Storage - For Museum",
"Electrical / Mechanical",
"Gymnasium / Exercise Center",
"Gymnasium / Exercise Center - Playing Area",
"Gymnasium / Exercise Center - Exercise Area",
"Courthouse / Police Station / Penitentiary",
"Courthouse / Police Station / Penitentiary - Courtroom",
"Courthouse / Police Station / Penitentiary - Confinement Cells",
"Courthouse / Police Station / Penitentiary - Judges' Chambers",
"Fire Stations",
"Fire Stations - Engine Room",
"Fire Stations - Sleeping Quarters",
"Post Office - Sorting Area",
"Convention Center - Exhibit Space",
"Library",
"Library - Card File and Cataloging",
"Library - Stacks",
"Library - Reading Area",
"Hospital",
"Hospital - Emergency",
"Hospital - Recovery",
"Hospital - Nurses' Station",
"Hospital - Exam / Treatment",
"Hospital - Pharmacy",
"Hospital - Patient Room",
"Hospital - Operating Room",
"Hospital - Nursery",
"Hospital - Medical Supply",
"Hospital - Physical Therapy",
"Hospital - Radiology",
"Hospital - Laundry-Washing",
"Automotive - Service / Repair",
"Manufacturing",
"Manufacturing - Low Bay (< 7.5m Floor to Ceiling Height)",
"Manufacturing - High Bay (> 7.5m Floor to Ceiling Height)",
"Manufacturing - Detailed Manufacturing",
"Manufacturing - Equipment Room",
"Manufacturing - Control Room",
"Hotel / Motel Guest Rooms",
"Dormitory - Living Quarters",
"Museum",
"Museum - General Exhibition",
"Museum - Restoration",
"Bank / Office - Banking Activity Area",
"Workshop",
"Sales Area",
"Religious Buildings",
"Religious Buildings - Worship Pulpit, Choir",
"Religious Buildings - Fellowship Hall",
"Retail",
"Retail - Sales Area",
"Retail - Mall Concourse",
"Sports Arena",
"Sports Arena - Ring Sports Area",
"Sports Arena - Court Sports Area",
"Sports Arena - Indoor Playing Field Area",
"Warehouse",
"Warehouse - Fine Material Storage",
"Warehouse - Medium / Bulky Material Storage",
"Parking Garage - Garage Area",
"Transportation",
"Transportation - Airport / Concourse",
"Transportation - Air / Train / Bus - Baggage Area",
"Transportation - Terminal - Ticket Counter"
]
import FreeCAD,ArchComponent,ArchCommands,math,Draft
if FreeCAD.GuiUp:
import FreeCADGui
@ -111,13 +223,16 @@ class _Space(ArchComponent.Component):
"A space object"
def __init__(self,obj):
ArchComponent.Component.__init__(self,obj)
obj.addProperty("App::PropertyLinkSubList","Boundaries", "Arch",translate("Arch","The objects that make the boundaries of this space object"))
obj.addProperty("App::PropertyFloat", "Area", "Arch",translate("Arch","The computed floor area of this space"))
obj.addProperty("App::PropertyString", "FinishFloor", "Arch",translate("Arch","The finishing of the floor of this space"))
obj.addProperty("App::PropertyString", "FinishWalls", "Arch",translate("Arch","The finishing of the walls of this space"))
obj.addProperty("App::PropertyString", "FinishCeiling","Arch",translate("Arch","The finishing of the ceiling of this space"))
obj.addProperty("App::PropertyLinkList", "Group", "Arch",translate("Arch","Objects that are included inside this space, such as furniture"))
obj.addProperty("App::PropertyLinkSubList","Boundaries", "Arch",translate("Arch","The objects that make the boundaries of this space object"))
obj.addProperty("App::PropertyFloat", "Area", "Arch",translate("Arch","The computed floor area of this space"))
obj.addProperty("App::PropertyString", "FinishFloor", "Arch",translate("Arch","The finishing of the floor of this space"))
obj.addProperty("App::PropertyString", "FinishWalls", "Arch",translate("Arch","The finishing of the walls of this space"))
obj.addProperty("App::PropertyString", "FinishCeiling", "Arch",translate("Arch","The finishing of the ceiling of this space"))
obj.addProperty("App::PropertyLinkList", "Group", "Arch",translate("Arch","Objects that are included inside this space, such as furniture"))
obj.addProperty("App::PropertyEnumeration","SpaceType", "Arch",translate("Arch","The type of this space"))
obj.addProperty("App::PropertyLength", "FloorThickness","Arch",translate("Arch","The thickness of the floor finish"))
self.Type = "Space"
self.SpaceType = "Undefined"
obj.Role = Roles
def execute(self,obj):

View File

@ -29,6 +29,7 @@ SET(Arch_SRCS
ArchPanel.py
ArchEquipment.py
ArchCutPlane.py
ArchServer.py
)
SOURCE_GROUP("" FILES ${Arch_SRCS})

View File

@ -78,7 +78,8 @@ class ArchWorkbench(Workbench):
self.utilities = ["Arch_SplitMesh","Arch_MeshToShape",
"Arch_SelectNonSolidMeshes","Arch_RemoveShape",
"Arch_CloseHoles","Arch_MergeWalls","Arch_Check",
"Arch_IfcExplorer","Arch_ToggleIfcBrepFlag","Arch_3Views"]
"Arch_IfcExplorer","Arch_ToggleIfcBrepFlag","Arch_3Views",
"Arch_Bimserver","Arch_Git"]
# draft tools
self.drafttools = ["Draft_Line","Draft_Wire","Draft_Circle","Draft_Arc","Draft_Ellipse",

View File

@ -51,6 +51,8 @@
<file>icons/Arch_StructuralSystem_Tree.svg</file>
<file>icons/Arch_ToggleIfcBrepFlag.svg</file>
<file>icons/Arch_CutPlane.svg</file>
<file>icons/Arch_Bimserver.svg</file>
<file>icons/Git.svg</file>
<file>ui/archprefs-base.ui</file>
<file>ui/archprefs-defaults.ui</file>
<file>ui/archprefs-import.ui</file>

View File

@ -0,0 +1,454 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48.000000px"
height="48.000000px"
id="svg249"
sodipodi:version="0.32"
inkscape:version="0.48.5 r10040"
sodipodi:docname="drawing-draft-view.svg"
inkscape:export-filename="/home/jimmac/gfx/novell/pdes/trunk/docs/BIGmime-text.png"
inkscape:export-xdpi="240.00000"
inkscape:export-ydpi="240.00000"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs3">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5031"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
inkscape:collect="always"
id="linearGradient5060">
<stop
style="stop-color:black;stop-opacity:1;"
offset="0"
id="stop5062" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5064" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5060"
id="radialGradient5029"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<linearGradient
id="linearGradient5048">
<stop
style="stop-color:black;stop-opacity:0;"
offset="0"
id="stop5050" />
<stop
id="stop5056"
offset="0.5"
style="stop-color:black;stop-opacity:1;" />
<stop
style="stop-color:black;stop-opacity:0;"
offset="1"
id="stop5052" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5048"
id="linearGradient5027"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
x1="302.85715"
y1="366.64789"
x2="302.85715"
y2="609.50507" />
<linearGradient
inkscape:collect="always"
id="linearGradient4542">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop4544" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop4546" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4542"
id="radialGradient4548"
cx="24.306795"
cy="42.07798"
fx="24.306795"
fy="42.07798"
r="15.821514"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,-6.310056e-16,30.08928)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient15662">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop15664" />
<stop
style="stop-color:#f8f8f8;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop15666" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="64.5679"
fx="20.8921"
r="5.257"
cy="64.5679"
cx="20.8921"
id="aigrd3">
<stop
id="stop15573"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15575"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
fy="114.5684"
fx="20.8921"
r="5.256"
cy="114.5684"
cx="20.8921"
id="aigrd2">
<stop
id="stop15566"
style="stop-color:#F0F0F0"
offset="0" />
<stop
id="stop15568"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
offset="1.0000000" />
</radialGradient>
<linearGradient
id="linearGradient269">
<stop
style="stop-color:#a3a3a3;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop270" />
<stop
style="stop-color:#4c4c4c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop271" />
</linearGradient>
<linearGradient
id="linearGradient259">
<stop
style="stop-color:#fafafa;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop260" />
<stop
style="stop-color:#bbbbbb;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop261" />
</linearGradient>
<linearGradient
id="linearGradient12512">
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop12513" />
<stop
style="stop-color:#fff520;stop-opacity:0.89108908;"
offset="0.50000000"
id="stop12517" />
<stop
style="stop-color:#fff300;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop12514" />
</linearGradient>
<radialGradient
r="37.751713"
fy="3.7561285"
fx="8.8244190"
cy="3.7561285"
cx="8.8244190"
gradientTransform="matrix(0.96827297,0,0,1.032767,29.045513,-115.18343)"
gradientUnits="userSpaceOnUse"
id="radialGradient15656"
xlink:href="#linearGradient269"
inkscape:collect="always" />
<radialGradient
r="86.708450"
fy="35.736916"
fx="33.966679"
cy="35.736916"
cx="33.966679"
gradientTransform="matrix(0.96049297,0,0,1.041132,25.691961,-115.82988)"
gradientUnits="userSpaceOnUse"
id="radialGradient15658"
xlink:href="#linearGradient259"
inkscape:collect="always" />
<radialGradient
r="38.158695"
fy="7.2678967"
fx="8.1435566"
cy="7.2678967"
cx="8.1435566"
gradientTransform="matrix(0.96827297,0,0,1.032767,29.045513,-115.18343)"
gradientUnits="userSpaceOnUse"
id="radialGradient15668"
xlink:href="#linearGradient15662"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#aigrd2"
id="radialGradient2283"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.8921"
cy="114.5684"
fx="20.8921"
fy="114.5684"
r="5.256" />
<radialGradient
inkscape:collect="always"
xlink:href="#aigrd3"
id="radialGradient2285"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
cx="20.8921"
cy="64.5679"
fx="20.8921"
fy="64.5679"
r="5.257" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-76"
id="linearGradient4343"
gradientUnits="userSpaceOnUse"
x1="18.971846"
y1="14.452502"
x2="44.524982"
y2="41.792759" />
<linearGradient
id="linearGradient3377-76">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop3379-5" />
<stop
id="stop4345"
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1;" />
<stop
style="stop-color:#c68708;stop-opacity:1;"
offset="1"
id="stop3381-7" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-76"
id="linearGradient4349"
x1="145.64697"
y1="79.160103"
x2="175.6825"
y2="108.75008"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4482">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop4484" />
<stop
id="stop4486"
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1;" />
<stop
style="stop-color:#c68708;stop-opacity:1;"
offset="1"
id="stop4488" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4351"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)"
cx="135.38333"
cy="97.369568"
fx="135.38333"
fy="97.369568"
r="19.467436" />
<linearGradient
id="linearGradient3377">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop3379" />
<stop
style="stop-color:#ffaa00;stop-opacity:1;"
offset="1"
id="stop3381" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="radialGradient4353"
gradientUnits="userSpaceOnUse"
cx="45.883327"
cy="28.869568"
fx="45.883327"
fy="28.869568"
r="19.467436" />
<linearGradient
id="linearGradient4495">
<stop
style="stop-color:#faff2b;stop-opacity:1;"
offset="0"
id="stop4497" />
<stop
style="stop-color:#ffaa00;stop-opacity:1;"
offset="1"
id="stop4499" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.32941176"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.01908"
inkscape:cx="33.4692"
inkscape:cy="19.044121"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1920"
inkscape:window-height="1053"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:showpageshadow="false"
inkscape:window-maximized="1"
inkscape:object-nodes="true" />
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Jakub Steiner</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://jimmac.musichall.cz</dc:source>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:label="Shadow"
id="layer6"
inkscape:groupmode="layer" />
<g
id="layer1"
inkscape:label="Base"
inkscape:groupmode="layer"
style="display:inline">
<path
style="fill:#696969;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;color:#000000;fill-opacity:1;fill-rule:nonzero;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 25.319719,16.100786 c 0,0 -7.033257,0.862141 -7.033257,0.862141 l 0.64402,21.218891 6.481285,-2.117647 z"
id="path3092"
inkscape:connector-curvature="0" />
<path
style="fill:#2d5b89;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="m 6.4433689,15.964659 11.0263281,5.490476 c 0,0 0.998269,25.047462 0.862141,24.775207 C 18.195711,45.958087 7.8953957,35.703148 7.8953957,35.703148 z"
id="path3082"
inkscape:connector-curvature="0" />
<path
style="fill:#535353;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;color:#000000;fill-opacity:1;fill-rule:nonzero;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 25.319717,16.100786 0.09205,19.963385 7.031959,4.94795 0.862141,-22.23416 -7.986148,-2.677175 z"
id="path3090"
inkscape:connector-curvature="0" />
<path
style="fill:#23476b;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="m 6.4433689,15.964659 c 0,0 19.1032271,-2.495671 19.4208581,-2.450295 0.317631,0.04537 14.06651,3.993073 14.06651,3.993073 l -6.624872,1.270524 -7.986148,-2.677175 -7.033255,0.862141 7.396262,3.085557 -8.213027,1.406651 z"
id="path3084"
inkscape:connector-curvature="0" />
<path
style="fill:#3a74ae;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="m 17.469697,21.455135 8.213027,-1.406651 -0.136128,23.55006 -7.124006,2.654486 z"
id="path3086"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#3a74ae;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;color:#000000;fill-opacity:1;fill-rule:nonzero;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 33.305865,18.777961 6.624872,-1.270524 -1.08902,21.099765 -6.397993,2.404919 z"
id="path3088"
inkscape:connector-curvature="0" />
<path
style="fill:#535353;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="M 17.87808,2.9871693 18.014207,9.9750483 25.7281,11.880833 25.68272,3.7131827 z"
id="path3094"
inkscape:connector-curvature="0" />
<path
style="fill:#414141;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="M 25.68272,3.7131827 33.804999,3.3955518 25.138214,2.7149143 17.87808,2.9871693 z"
id="path3096"
inkscape:connector-curvature="0" />
<path
style="fill:#696969;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;fill-opacity:1"
d="M 25.68272,3.7131827 33.804999,3.3955518 33.532744,11.064068 25.7281,11.880833 z"
id="path3098"
inkscape:connector-curvature="0" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="new"
style="display:inline" />
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="97px" height="97px" viewBox="0 0 97 97" enable-background="new 0 0 97 97" xml:space="preserve">
<g>
<path fill="#F05133" d="M92.71,44.408L52.591,4.291c-2.31-2.311-6.057-2.311-8.369,0l-8.33,8.332L46.459,23.19
c2.456-0.83,5.272-0.273,7.229,1.685c1.969,1.97,2.521,4.81,1.67,7.275l10.186,10.185c2.465-0.85,5.307-0.3,7.275,1.671
c2.75,2.75,2.75,7.206,0,9.958c-2.752,2.751-7.208,2.751-9.961,0c-2.068-2.07-2.58-5.11-1.531-7.658l-9.5-9.499v24.997
c0.67,0.332,1.303,0.774,1.861,1.332c2.75,2.75,2.75,7.206,0,9.959c-2.75,2.749-7.209,2.749-9.957,0c-2.75-2.754-2.75-7.21,0-9.959
c0.68-0.679,1.467-1.193,2.307-1.537V36.369c-0.84-0.344-1.625-0.853-2.307-1.537c-2.083-2.082-2.584-5.14-1.516-7.698
L31.798,16.715L4.288,44.222c-2.311,2.313-2.311,6.06,0,8.371l40.121,40.118c2.31,2.311,6.056,2.311,8.369,0L92.71,52.779
C95.021,50.468,95.021,46.719,92.71,44.408z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -148,6 +148,42 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Bim server</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefLineEdit" name="lineEdit">
<property name="toolTip">
<string>The URL of a bim server instance (www.bimserver.org) to connect to.</string>
</property>
<property name="text">
<string>http://localhost:8082</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>BimServerUrl</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
@ -201,6 +237,10 @@
</spacer>
</item>
</layout>
<zorder>groupBox_4</zorder>
<zorder>groupBox_2</zorder>
<zorder>groupBox</zorder>
<zorder>groupBox_3</zorder>
</widget>
<layoutdefault spacing="6" margin="11"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>

410
src/Mod/Arch/importGBXML.py Normal file
View File

@ -0,0 +1,410 @@
#***************************************************************************
#* *
#* Copyright (c) 2015 *
#* Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
__title__= "FreeCAD GbXml exporter"
__author__ = "Yorik van Havre"
__url__ = "http://www.freecadweb.org"
import os,FreeCAD,Draft
if FreeCAD.GuiUp:
from DraftTools import translate
else:
def translate(ctx,txt):
return txt
if open.__module__ == '__builtin__':
pyopen = open # because we'll redefine open below
def export(objectslist,filename):
if len(objectslist) != 1:
FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object"))
return
site = objectslist[0]
if Draft.getType(site) != "Site":
FreeCAD.Console.PrintError(translate("Arch","This exporter can currently only export one site object"))
return
filestream = pyopen(filename,"wb")
# header
filestream.write( '<?xml version="1.0"?>\n' )
filestream.write( '<!-- Exported by FreeCAD %s -->\n' % FreeCAD.Version()[0]+FreeCAD.Version()[1]+FreeCAD.Version()[2] )
filestream.write( '<gbXML xmlns="http://www.gbxml.org/schema" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gbxml.org/schema" temperatureUnit="C" lengthUnit="Millimeters" areaUnit="SquareMeters" volumeUnit="CubicMeters" useSIUnitsForResults="false">\n' )
filestream.write( '\n' )
# campus
filestream.write( '<Campus id="%s">\n' % site.Name )
filestream.write( '<Location>\n' )
filestream.write( ' <ZipcodeOrPostalCode>%s</ZipcodeOrPostalCode>\n' % site.PostalCode )
filestream.write( '</Location>\n' )
# building
for building in site.Group:
if Draft.getType(building) == "Building":
area = 10000.0 # TODO calculate
filestream.write( ' <Building id="$s" buildingType="$s">\n' % (building.Name,building.BuildingType) )
filestream.write( ' <Area>$f</Area>\n' % area )
# space
for space in Draft.getGroupContents(building):
if Draft.getType(space) == "Space":
zone = "BLABLA" # TODO build values
filestream.write( ' <Space id="%s" spaceType="%s" zoneIdRef="%s">\n' % (space.Name, space.SpaceType, zone) )
filestream.write( ' <Name>%s</Name>\n' % space.Label )
filestream.write( ' <Description>%s</Description>\n' % space.Description )
filestream.write( ' <Name>%s</Name>\n' % space.Label )
#filestream.write( ' <PeopleNumber unit="NumberOfPeople">1.00000</PeopleNumber>\n' )
#filestream.write( ' <LightPowerPerArea unit="WattPerSquareFoot">1.50000</LightPowerPerArea>\n' )
#filestream.write( ' <EquipPowerPerArea unit="WattPerSquareFoot">0.00000</EquipPowerPerArea>\n' )
filestream.write( ' <Area>$f</Area>\n' % space.Area
filestream.write( ' </Building>\n' )
filestream.write( '</Campus>\n' )
filestream.write( '</gbXML>' )
'''
<Area>18000.00000</Area>
<Space id="sp1_LabandCorridor_Labcorridor" spaceType="LaboratoryOffice" zoneIdRef="z1_LabandCorridor">
<Name>Lab corridor</Name>
<Description/>
<PeopleNumber unit="NumberOfPeople">1.00000</PeopleNumber>
<LightPowerPerArea unit="WattPerSquareFoot">1.50000</LightPowerPerArea>
<EquipPowerPerArea unit="WattPerSquareFoot">0.00000</EquipPowerPerArea>
<Area>800.00000</Area>
<Volume>6400.00000</Volume>
<ShellGeometry id="geo_sp1_LabandCorridor_Labcorridor">
<ClosedShell>
<PolyLoop>
<CartesianPoint>
<Coordinate>0.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>0.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>480.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>480.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
... repeat
</ClosedShell>
</ShellGeometry>
<CADObjectId>21E2</CADObjectId>
</Space>
... repeat
</Building>
<Surface id="su1_Floor" surfaceType="UndergroundSlab" constructionIdRef="construction-1">
<Name>Floor</Name>
<AdjacentSpaceId spaceIdRef="sp1_LabandCorridor_Labcorridor"/>
<RectangularGeometry>
<Azimuth>90.00</Azimuth>
<CartesianPoint>
<Coordinate>0.00000</Coordinate>
<Coordinate>1320.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<Tilt>180.00</Tilt>
<Height>480.00000</Height>
<Width>240.00000</Width>
</RectangularGeometry>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>0.00000</Coordinate>
<Coordinate>1320.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>480.00000</Coordinate>
<Coordinate>1320.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>960.00000</Coordinate>
<Coordinate>1320.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>960.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>480.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>0.00000</Coordinate>
<Coordinate>1200.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
</Surface>
<Surface id="su44_Surface4" surfaceType="ExteriorWall" constructionIdRef="construction-3">
<Name>Surface 4</Name>
<AdjacentSpaceId spaceIdRef="sp7_Office_Office6"/>
<RectangularGeometry>
<Azimuth>180.00</Azimuth>
<CartesianPoint>
<Coordinate>960.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<Tilt>90.00</Tilt>
<Height>114.00000</Height>
<Width>480.00000</Width>
</RectangularGeometry>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>960.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1440.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1440.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>114.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>960.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>114.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
<Opening id="su44-op1_Opening1" openingType="OperableWindow" windowTypeIdRef="windowType-1">
<Name>Opening1</Name>
<RectangularGeometry>
<CartesianPoint>
<Coordinate>96.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<Height>72.00000</Height>
<Width>48.00000</Width>
</RectangularGeometry>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>1056.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1104.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1104.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1056.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
</Opening>
<Opening id="su44-op2_Opening2" openingType="OperableWindow" windowTypeIdRef="windowType-1">
<Name>Opening2</Name>
<RectangularGeometry>
<CartesianPoint>
<Coordinate>216.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<Height>72.00000</Height>
<Width>48.00000</Width>
</RectangularGeometry>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>1176.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1224.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1224.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1176.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
</Opening>
<Opening id="su44-op3_Opening3" openingType="OperableWindow" windowTypeIdRef="windowType-1">
<Name>Opening3</Name>
<RectangularGeometry>
<CartesianPoint>
<Coordinate>336.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<Height>72.00000</Height>
<Width>48.00000</Width>
</RectangularGeometry>
<PlanarGeometry>
<PolyLoop>
<CartesianPoint>
<Coordinate>1296.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1344.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>24.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1344.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
<CartesianPoint>
<Coordinate>1296.00000</Coordinate>
<Coordinate>0.00000</Coordinate>
<Coordinate>96.00000</Coordinate>
</CartesianPoint>
</PolyLoop>
</PlanarGeometry>
</Opening>
</Surface>
... repeat
</Campus>
<Construction id="construction-1">
<Name>Standard</Name>
<Description/>
</Construction>
<Construction id="construction-2">
<Name>Standard</Name>
<Description/>
</Construction>
<Construction id="construction-3">
<Name>Standard</Name>
<Description/>
</Construction>
<WindowType id="windowType-1">
<Name>Standard</Name>
<Description/>
</WindowType>
<Zone id="z1_LabandCorridor">
<Name>Lab and Corridor</Name>
<Description/>
<AirChangesPerHour>0"</AirChangesPerHour>
<FlowPerArea unit="CFMPerSquareFoot">0.00000</FlowPerArea>
<FlowPerPerson unit="CFM">0.00000</FlowPerPerson>
<OAFlowPerArea unit="CFMPerSquareFoot">2.37037</OAFlowPerArea>
<OAFlowPerPerson unit="CFM">812.69841</OAFlowPerPerson>
<DesignHeatT>72.00000</DesignHeatT>
<DesignCoolT>75.00000</DesignCoolT>
</Zone>
<Zone id="z2_Office">
<Name>Office</Name>
<Description/>
<AirChangesPerHour>1"</AirChangesPerHour>
<FlowPerArea unit="CFMPerSquareFoot">0.13333</FlowPerArea>
<FlowPerPerson unit="CFM">20.00000</FlowPerPerson>
<OAFlowPerArea unit="CFMPerSquareFoot">0.05333</OAFlowPerArea>
<OAFlowPerPerson unit="CFM">8.00000</OAFlowPerPerson>
<DesignHeatT>72.00000</DesignHeatT>
<DesignCoolT>75.00000</DesignCoolT>
</Zone>
<Zone id="z3_Warehouse">
<Name>Warehouse</Name>
<Description/>
<AirChangesPerHour>5/32"</AirChangesPerHour>
<FlowPerArea unit="CFMPerSquareFoot">0.05000</FlowPerArea>
<FlowPerPerson unit="CFM">25.71429</FlowPerPerson>
<OAFlowPerArea unit="CFMPerSquareFoot">0.00000</OAFlowPerArea>
<OAFlowPerPerson unit="CFM">0.00000</OAFlowPerPerson>
<DesignHeatT>60.00000</DesignHeatT>
<DesignCoolT>80.00000</DesignCoolT>
</Zone>
<Results xmlns="" id="sp3_LabandCorridor_Lab1" objectIdRef="sp3_LabandCorridor_Lab1" resultsType="CoolingLoad" unit="BtuPerHour">
<ObjectId>sp3_LabandCorridor_Lab1</ObjectId>
<Value>5534.837890625</Value>
<Description>Space Cooling Roof Cond</Description>
<CADObjectId>21E3</CADObjectId>
</Results>
... repeat
</gbXML>'''

View File

@ -87,6 +87,15 @@ END-ISO-10303-21;
"""
def doubleClickTree(item,column):
txt = item.text(column)
if "Entity #" in txt:
eid = txt.split("#")[1].split(":")[0]
addr = tree.findItems(eid,0,0)
if addr:
tree.scrollToItem(addr[0])
addr[0].setSelected(True)
def explore(filename=None):
"""explore([filename]): opens a dialog showing
the contents of an IFC file. If no filename is given, a dialog will
@ -118,6 +127,7 @@ def explore(filename=None):
return
ifc = ifcopenshell.open(filename)
global tree
tree = QtGui.QTreeWidget()
tree.setColumnCount(3)
tree.setWordWrap(True)
@ -136,11 +146,18 @@ def explore(filename=None):
entities += ifc.by_type("IfcRepresentation")
entities += ifc.by_type("IfcRepresentationItem")
entities += ifc.by_type("IfcPlacement")
entities += ifc.by_type("IfcProperty")
entities += ifc.by_type("IfcPhysicalSimpleQuantity")
entities = sorted(entities, key=lambda eid: eid.id())
done = []
for entity in entities:
item = QtGui.QTreeWidgetItem(tree)
if hasattr(entity,"id"):
if entity.id() in done:
continue
done.append(entity.id())
item = QtGui.QTreeWidgetItem(tree)
item.setText(0,str(entity.id()))
if entity.is_a() in ["IfcWall","IfcWallStandardCase"]:
item.setIcon(1,QtGui.QIcon(":icons/Arch_Wall_Tree.svg"))
@ -162,6 +179,8 @@ def explore(filename=None):
item.setIcon(1,QtGui.QIcon(":icons/Draft_SwitchMode.svg"))
elif entity.is_a() in ["IfcArbitraryClosedProfileDef","IfcPolyloop"]:
item.setIcon(1,QtGui.QIcon(":icons/Draft_Draft.svg"))
elif entity.is_a() in ["IfcPropertySingleValue","IfcQuantityArea","IfcQuantityVolume"]:
item.setIcon(1,QtGui.QIcon(":icons/Tree_Annotation.svg"))
item.setText(2,str(entity.is_a()))
item.setFont(2,bold);
@ -179,8 +198,13 @@ def explore(filename=None):
break
else:
if not argname in ["Id", "GlobalId"]:
colored = False
if isinstance(argvalue,ifcopenshell.entity_instance):
t = "Entity #" + str(argvalue.id()) + ": " + str(argvalue.is_a())
if argvalue.id() == 0:
t = str(argvalue)
else:
colored = True
t = "Entity #" + str(argvalue.id()) + ": " + str(argvalue.is_a())
elif isinstance(argvalue,list):
t = ""
else:
@ -188,15 +212,24 @@ def explore(filename=None):
t = " " + str(argname) + " : " + str(t)
item = QtGui.QTreeWidgetItem(tree)
item.setText(2,str(t))
if colored:
item.setForeground(2,QtGui.QBrush(QtGui.QColor("#005AFF")))
if isinstance(argvalue,list):
for argitem in argvalue:
colored = False
if isinstance(argitem,ifcopenshell.entity_instance):
t = "Entity #" + str(argitem.id()) + ": " + str(argitem.is_a())
if argitem.id() == 0:
t = str(argitem)
else:
colored = True
t = "Entity #" + str(argitem.id()) + ": " + str(argitem.is_a())
else:
t = argitem
t = " " + str(t)
item = QtGui.QTreeWidgetItem(tree)
item.setText(2,str(t))
if colored:
item.setForeground(2,QtGui.QBrush(QtGui.QColor("#005AFF")))
i += 1
d = QtGui.QDialog()
@ -205,8 +238,11 @@ def explore(filename=None):
d.resize(640, 480)
layout = QtGui.QVBoxLayout(d)
layout.addWidget(tree)
tree.itemDoubleClicked.connect(doubleClickTree)
d.exec_()
del tree
return

View File

@ -1742,9 +1742,12 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
def getPath(edges=[],wires=[],pathname=None):
import DraftGeomUtils
svg = "<path "
if pathname is None:
pathname = obj.Name
svg ='<path id="%s" d="' % pathname
svg += 'id="%s" ' % obj.Name
elif pathname != "":
svg += 'id="%s" ' % pathname
svg += ' d="'
if not wires:
egroups = (DraftGeomUtils.sortEdges(edges),)
else:
@ -1807,7 +1810,8 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
flag_large_arc = (((e.ParameterRange[1] - \
e.ParameterRange[0]) / math.pi) % 2) > 1
flag_sweep = (c.Axis * drawing_plane_normal >= 0) \
== (e.Orientation == "Forward")
== (e.LastParameter > e.FirstParameter)
# == (e.Orientation == "Forward")
for v in endpoints:
svg += 'A %s %s %s %s %s %s %s ' % \
(str(rx),str(ry),str(rot),\
@ -1963,7 +1967,13 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
if not obj:
pass
elif isinstance(obj,Part.Shape):
fill = 'url(#'+fillstyle+')'
lstyle = getLineStyle()
svg += getPath(obj.Edges,pathname="")
elif getType(obj) == "Dimension":
if obj.ViewObject.Proxy:
if hasattr(obj.ViewObject.Proxy,"p1"):

View File

@ -662,6 +662,8 @@ def sortEdges(edges):
# Build a dictionary of edges according to their end points.
# Each entry is a set of edges that starts, or ends, at the
# given vertex hash.
if len(edges) < 2:
return edges
sdict = dict()
edict = dict()
nedges = []
@ -670,6 +672,9 @@ def sortEdges(edges):
sdict.setdefault( e.Vertexes[0].hashCode(), [] ).append(e)
edict.setdefault( e.Vertexes[-1].hashCode(),[] ).append(e)
nedges.append(e)
if not nedges:
print "DraftGeomUtils.sortEdges: zero-length edges"
return edges
# Find the start of the path. The start is the vertex that appears
# in the sdict dictionary but not in the edict dictionary, and has
# only one edge ending there.
@ -719,7 +724,7 @@ def sortEdges(edges):
eh = e.hashCode()
e = invert(e)
except KeyError:
print("DraftGeomUtils.sortEdges failed - running old version:")
print("DraftGeomUtils.sortEdges failed - running old version")
return sortEdgesOld(edges)
ret.append(e)
# All done.

View File

@ -11,6 +11,7 @@ INSTALL(
DrawingAlgos.py
DrawingExample.py
DrawingTests.py
DrawingPatterns.py
DESTINATION
Mod/Drawing
)

File diff suppressed because one or more lines are too long