Arch: minor fixes around Arch & Draft
This commit is contained in:
parent
be33ef6f4c
commit
b6c24cfc35
|
@ -325,6 +325,8 @@ def closeHole(shape):
|
|||
def getCutVolume(cutplane,shapes):
|
||||
"""getCutVolume(cutplane,shapes): returns a cut face and a cut volume
|
||||
from the given shapes and the given cutting plane"""
|
||||
if not shapes:
|
||||
return None,None,None
|
||||
import Part
|
||||
if not isinstance(shapes,list):
|
||||
shapes = [shapes]
|
||||
|
@ -652,8 +654,8 @@ def getBrepFacesData(obj,scale=1):
|
|||
of solids inside the object. Scale can indicate a scaling factor"""
|
||||
if hasattr(obj,"Shape"):
|
||||
if obj.Shape:
|
||||
if obj.Shape.isValid():
|
||||
if not obj.Shape.isNull():
|
||||
if not obj.Shape.isNull():
|
||||
if obj.Shape.isValid():
|
||||
sols = []
|
||||
for sol in obj.Shape.Solids:
|
||||
s = []
|
||||
|
|
|
@ -155,17 +155,19 @@ class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent):
|
|||
self.lcoords = coin.SoCoordinate3()
|
||||
ls = coin.SoType.fromName("SoBrepEdgeSet").createInstance()
|
||||
ls.coordIndex.setValues(0,57,[0,1,-1,2,3,4,5,-1,6,7,8,9,-1,10,11,-1,12,13,14,15,-1,16,17,18,19,-1,20,21,-1,22,23,24,25,-1,26,27,28,29,-1,30,31,-1,32,33,34,35,-1,36,37,38,39,-1,40,41,42,43,44])
|
||||
sep = coin.SoSeparator()
|
||||
psep = coin.SoSeparator()
|
||||
fsep = coin.SoSeparator()
|
||||
fsep.addChild(self.mat2)
|
||||
fsep.addChild(self.fcoords)
|
||||
fsep.addChild(fs)
|
||||
psep.addChild(fsep)
|
||||
psep.addChild(self.mat1)
|
||||
psep.addChild(self.drawstyle)
|
||||
psep.addChild(self.lcoords)
|
||||
psep.addChild(ls)
|
||||
vobj.addDisplayMode(psep,"Default")
|
||||
sep.addChild(fsep)
|
||||
sep.addChild(psep)
|
||||
vobj.addDisplayMode(sep,"Default")
|
||||
self.onChanged(vobj,"DisplaySize")
|
||||
self.onChanged(vobj,"LineColor")
|
||||
self.onChanged(vobj,"Transparency")
|
||||
|
@ -318,7 +320,10 @@ class _ArchDrawingView:
|
|||
self.direction = p.Rotation.multVec(FreeCAD.Vector(0,0,1))
|
||||
for o in objs:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
if o.Shape.isValid():
|
||||
if o.Shape.isNull():
|
||||
pass
|
||||
#FreeCAD.Console.PrintWarning(translate("Arch","Skipping empty object: ")+o.Name)
|
||||
elif o.Shape.isValid():
|
||||
shapes.extend(o.Shape.Solids)
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(translate("Arch","Skipping invalid object: ")+o.Name)
|
||||
|
|
|
@ -2911,8 +2911,7 @@ class _ViewProviderDraftAlt(_ViewProviderDraft):
|
|||
"a view provider that doesn't swallow its base object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
vobj.Proxy = self
|
||||
self.Object = vobj.Object
|
||||
_ViewProviderDraft.__init__(self,vobj)
|
||||
|
||||
def claimChildren(self):
|
||||
return []
|
||||
|
@ -2921,8 +2920,7 @@ class _ViewProviderDraftPart(_ViewProviderDraftAlt):
|
|||
"a view provider that displays a Part icon instead of a Draft icon"
|
||||
|
||||
def __init__(self,vobj):
|
||||
vobj.Proxy = self
|
||||
self.Object = vobj.Object
|
||||
_ViewProviderDraftAlt.__init__(self,vobj)
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/Tree_Part.svg"
|
||||
|
@ -3190,9 +3188,7 @@ class _ViewProviderDimension(_ViewProviderDraft):
|
|||
def onChanged(self, vobj, prop):
|
||||
"called when a view property has changed"
|
||||
|
||||
if prop in ["ExtLines","TextSpacing","DisplayMode","Override","FlipArrows","Decimals"]:
|
||||
self.updateData(vobj.Object,"Start")
|
||||
elif prop == "FontSize":
|
||||
if prop == "FontSize":
|
||||
if hasattr(self,"font"):
|
||||
self.font.size = vobj.FontSize.Value
|
||||
if hasattr(self,"font3d"):
|
||||
|
@ -3248,6 +3244,8 @@ class _ViewProviderDimension(_ViewProviderDraft):
|
|||
self.marks.addChild(s2)
|
||||
self.node.insertChild(self.marks,2)
|
||||
self.node3d.insertChild(self.marks,2)
|
||||
else:
|
||||
self.updateData(vobj.Object,"Start")
|
||||
|
||||
def getDisplayModes(self,vobj):
|
||||
return ["2D","3D"]
|
||||
|
@ -4119,7 +4117,7 @@ class _Shape2DView(_DraftObject):
|
|||
obj.addProperty("App::PropertyBool","HiddenLines","Draft","Show hidden lines")
|
||||
obj.addProperty("App::PropertyBool","Tessellation","Draft","Tessellate BSplines into line segments using number of spline poles")
|
||||
obj.Projection = Vector(0,0,1)
|
||||
obj.ProjectionMode = ["Solid","Individual Faces","Cutlines"]
|
||||
obj.ProjectionMode = ["Solid","Individual Faces","Cutlines","Cutfaces"]
|
||||
obj.HiddenLines = False
|
||||
obj.Tessellation = True
|
||||
_DraftObject.__init__(self,obj,"Shape2DView")
|
||||
|
@ -4167,11 +4165,21 @@ class _Shape2DView(_DraftObject):
|
|||
opl = FreeCAD.Placement(obj.Base.Placement)
|
||||
proj = opl.Rotation.multVec(FreeCAD.Vector(0,0,1))
|
||||
obj.Shape = self.getProjected(obj,comp,proj)
|
||||
elif obj.ProjectionMode == "Cutlines":
|
||||
elif obj.ProjectionMode in ["Cutlines","Cutfaces"]:
|
||||
for sh in shapes:
|
||||
if sh.Volume < 0:
|
||||
sh.reverse()
|
||||
c = sh.section(cutp)
|
||||
if (obj.ProjectionMode == "Cutfaces") and (sh.ShapeType == "Solid"):
|
||||
try:
|
||||
c = Part.Wire(DraftGeomUtils.sortEdges(c.Edges))
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
c = Part.Face(c)
|
||||
except:
|
||||
pass
|
||||
cuts.append(c)
|
||||
comp = Part.makeCompound(cuts)
|
||||
opl = FreeCAD.Placement(obj.Base.Placement)
|
||||
|
|
|
@ -1081,7 +1081,7 @@ class Snapper:
|
|||
b.setIcon(QtGui.QIcon(":/icons/Snap_"+n+".svg"))
|
||||
b.setIconSize(QtCore.QSize(16, 16))
|
||||
b.setMaximumSize(QtCore.QSize(26,26))
|
||||
b.setToolTip(c)
|
||||
b.setToolTip(n)
|
||||
b.setObjectName("SnapButton"+n)
|
||||
b.setCheckable(True)
|
||||
b.setChecked(True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user