BIM: Fixed leftover bugs

This commit is contained in:
Yorik van Havre
2024-05-02 15:26:48 +02:00
committed by Yorik van Havre
parent 76e901861d
commit 3593946d1c
13 changed files with 32 additions and 18 deletions

View File

@@ -44,6 +44,7 @@ translate = FreeCAD.Qt.translate
# generic functions
from ArchCommands import *
from ArchWindowPresets import *
# TODO: migrate this one
@@ -122,7 +123,7 @@ def makeFloor(objectslist=None,baseobj=None,name=None):
"""makes a BuildingPart and turns it into a Floor/Level"""
obj = makeBuildingPart(objectslist)
obj.Label = name if name else translate("Arch","Floor")
obj.Label = name if name else translate("Arch","Level")
obj.IfcType = "Building Storey"
return obj
@@ -871,7 +872,7 @@ def makeRailing(stairs):
outlineLRAll = stair.OutlineRightAll
stairRailingLR = "RailingRight"
if outlineLR or outlineLRAll:
lrRail = ArchPipe.makePipe(baseobj=None,diameter=0,length=0,placement=None,name=translate("Arch","Railing"))
lrRail = Arch.makePipe(baseobj=None,diameter=0,length=0,placement=None,name=translate("Arch","Railing"))
if outlineLRAll:
setattr(stair, stairRailingLR, lrRail)
break

View File

@@ -501,14 +501,14 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
return (s,wp)
if windowtype in WindowPresets:
import ArchWindow
import Arch
default = makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2)
FreeCAD.ActiveDocument.recompute()
if default:
if placement:
default[0].Placement = placement
FreeCAD.ActiveDocument.recompute()
obj = ArchWindow.makeWindow(default[0],width,height,default[1])
obj = Arch.makeWindow(default[0],width,height,default[1])
obj.Preset = WindowPresets.index(windowtype)+1
obj.Frame = w2
obj.Offset = o1

View File

@@ -30,7 +30,7 @@ import FreeCADGui
from draftguitools import gui_lines # Line tool from Draft
QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
translate = FreeCAD.Qt.translate
class BIM_Leader(gui_lines.Line):
@@ -51,6 +51,7 @@ class BIM_Leader(gui_lines.Line):
super(BIM_Leader, self).Activated(name="Leader", icon="Draft_Wire")
def finish(self, closed=False, cont=False):
import DraftVecUtils
self.removeTemporaryObject()
if getattr(self,"oldWP",None):
FreeCAD.DraftWorkingPlane = self.oldWP

View File

@@ -49,9 +49,10 @@ class Arch_Profile:
def Activated(self):
import ArchProfile
self.Profile = None
self.Categories = []
self.Presets = readPresets()
self.Presets = ArchProfile.readPresets()
for pre in self.Presets:
if pre[1] not in self.Categories:
self.Categories.append(pre[1])
@@ -62,6 +63,7 @@ class Arch_Profile:
"sets up a taskbox widget"
from PySide import QtGui
from draftutils import params
w = QtGui.QWidget()
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Profile settings"))

View File

@@ -45,6 +45,7 @@ class Arch_Roof:
return not FreeCAD.ActiveDocument is None
def Activated(self):
import ArchComponent
sel = FreeCADGui.Selection.getSelectionEx()
if sel:
sel = sel[0]

View File

@@ -28,6 +28,7 @@ import FreeCAD
import FreeCADGui
QT_TRANSLATE_NOOP = FreeCAD.Qt.QT_TRANSLATE_NOOP
translate = FreeCAD.Qt.translate
class BIM_Slab:

View File

@@ -49,6 +49,7 @@ class Arch_Space:
def Activated(self):
import ArchComponent
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Space"))
FreeCADGui.addModule("Arch")
sel = FreeCADGui.Selection.getSelection()

View File

@@ -68,6 +68,7 @@ class Arch_Wall:
import Draft
import WorkingPlane
from draftutils import params
import draftguitools.gui_trackers as DraftTrackers
self.Align = ["Center","Left","Right"][params.get_param_arch("WallAlignment")]
self.MultiMat = None
self.Length = None
@@ -199,6 +200,7 @@ class Arch_Wall:
created a Part.LineSegment assigned as the variable "trace"
"""
from draftutils import params
FreeCADGui.addModule("Draft")
FreeCADGui.addModule("WorkingPlane")
FreeCADGui.doCommand("wp = WorkingPlane.get_working_plane()")
@@ -262,6 +264,7 @@ class Arch_Wall:
from PySide import QtCore, QtGui
import Draft
from draftutils import params
w = QtGui.QWidget()
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Wall options"))

View File

@@ -153,6 +153,7 @@ class Arch_Window:
import Draft
self.tracker.finalize()
from ArchWindowPresets import WindowPresets
if point is None:
return
# if something was selected, override the underlying object
@@ -252,6 +253,8 @@ class Arch_Window:
"sets up a taskbox widget"
from draftutils import params
from PySide import QtCore, QtGui, QtSvg
from ArchWindowPresets import WindowPresets
w = QtGui.QWidget()
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Window options"))
@@ -261,14 +264,14 @@ class Arch_Window:
include = QtGui.QCheckBox(translate("Arch","Auto include in host object"))
include.setChecked(True)
grid.addWidget(include,0,0,1,2)
QtCore.QObject.connect(include,QtCore.SIGNAL("stateChanged(int)"),self.setInclude)
include.stateChanged.connect(self.setInclude)
# sill height
labels = QtGui.QLabel(translate("Arch","Sill height"))
values = ui.createWidget("Gui::InputField")
grid.addWidget(labels,1,0,1,1)
grid.addWidget(values,1,1,1,1)
QtCore.QObject.connect(values,QtCore.SIGNAL("valueChanged(double)"),self.setSill)
values.valueChanged.connect(self.setSill)
# check for Parts library and Arch presets
@@ -303,7 +306,7 @@ class Arch_Window:
valuep.setCurrentIndex(self.Preset)
grid.addWidget(labelp,2,0,1,1)
grid.addWidget(valuep,2,1,1,1)
QtCore.QObject.connect(valuep,QtCore.SIGNAL("currentIndexChanged(int)"),self.setPreset)
valuep.currentIndexChanged.connect(self.setPreset)
for it in self.librarypresets:
valuep.addItem(it[0])
@@ -386,6 +389,7 @@ class Arch_Window:
def setPreset(self,i):
from draftutils import params
from ArchWindowPresets import WindowPresets
self.Preset = i
if self.doormode:
params.set_param_arch("DoorPreset",i)

View File

@@ -39,11 +39,11 @@ import Draft
import Arch
import DraftVecUtils
import ArchIFCSchema
import exportIFCHelper
import exportIFCStructuralTools
from importers import exportIFCHelper
from importers import exportIFCStructuralTools
from DraftGeomUtils import vec
from importIFCHelper import dd2dms
from importers.importIFCHelper import dd2dms
from draftutils import params
from draftutils.messages import _msg, _err
@@ -2231,7 +2231,7 @@ def getRepresentation(
if not joinfacets:
shapetype = "triangulated"
if usedae:
import importDAE
from importers import importDAE
tris = importDAE.triangulate(fcsolid)
else:
tris = fcsolid.tessellate(tessellation)

View File

@@ -39,8 +39,8 @@ import Draft
import Arch
import DraftVecUtils
import ArchIFCSchema
import importIFCHelper
import importIFCmulticore
from importers import importIFCHelper
from importers import importIFCmulticore
from draftutils import params
from draftutils.messages import _msg, _err
@@ -152,7 +152,7 @@ def export(exportList, filename, colors=None, preferences=None):
The export code is now in a separate module; this call is retained
in this module for compatibility purposes with older scripts.
"""
import exportIFC
from importers import exportIFC
exportIFC.export(exportList, filename, colors, preferences)

View File

@@ -27,7 +27,7 @@ import os
import FreeCAD
import Draft
import Arch
import importIFCHelper
from importers import importIFCHelper
from FreeCAD import Base
import ArchIFC

View File

@@ -71,7 +71,7 @@ def htmlize(diff):
def show_diff(diff):
"""Shows a dialog showing the diff contents"""
dlg = FreeCADGui.PySideUic.loadUi(":/ui/dialogDiff.ui"))
dlg = FreeCADGui.PySideUic.loadUi(":/ui/dialogDiff.ui")
dlg.textEdit.setStyleSheet("background-color: white; color: black;")
dlg.textEdit.setHtml(htmlize(diff))
result = dlg.exec_()