Arch: Extended panel tools
This commit is contained in:
parent
b97f93c5a8
commit
59987231ae
|
@ -63,7 +63,7 @@ def addToComponent(compobject,addobject,mod=None):
|
|||
if compobject == addobject: return
|
||||
# first check zis already there
|
||||
found = False
|
||||
attribs = ["Additions","Objects","Components","Subtractions","Base"]
|
||||
attribs = ["Additions","Objects","Components","Subtractions","Base","Group"]
|
||||
for a in attribs:
|
||||
if hasattr(compobject,a):
|
||||
if a == "Base":
|
||||
|
@ -89,6 +89,8 @@ def addToComponent(compobject,addobject,mod=None):
|
|||
setattr(compobject,mod,l)
|
||||
if mod != "Objects":
|
||||
addobject.ViewObject.hide()
|
||||
if Draft.getType(compobject) == "PanelSheet":
|
||||
addobject.Placement.move(compobject.Placement.Base.negative())
|
||||
else:
|
||||
for a in attribs[:3]:
|
||||
if hasattr(compobject,a):
|
||||
|
@ -106,7 +108,7 @@ def removeFromComponent(compobject,subobject):
|
|||
it is added as a subtraction.'''
|
||||
if compobject == subobject: return
|
||||
found = False
|
||||
attribs = ["Additions","Subtractions","Objects","Components","Base","Axes","Fixtures"]
|
||||
attribs = ["Additions","Subtractions","Objects","Components","Base","Axes","Fixtures","Group"]
|
||||
for a in attribs:
|
||||
if hasattr(compobject,a):
|
||||
if a == "Base":
|
||||
|
@ -120,6 +122,8 @@ def removeFromComponent(compobject,subobject):
|
|||
l.remove(subobject)
|
||||
setattr(compobject,a,l)
|
||||
subobject.ViewObject.show()
|
||||
if Draft.getType(compobject) == "PanelSheet":
|
||||
subobject.Placement.move(compobject.Placement.Base)
|
||||
found = True
|
||||
if not found:
|
||||
if hasattr(compobject,"Subtractions"):
|
||||
|
@ -154,7 +158,7 @@ class ComponentTaskPanel:
|
|||
# the categories are shown only if they are not empty.
|
||||
|
||||
self.obj = None
|
||||
self.attribs = ["Base","Additions","Subtractions","Objects","Components","Axes","Fixtures","Armatures"]
|
||||
self.attribs = ["Base","Additions","Subtractions","Objects","Components","Axes","Fixtures","Armatures","Group"]
|
||||
self.baseform = QtGui.QWidget()
|
||||
self.baseform.setObjectName("TaskPanel")
|
||||
self.grid = QtGui.QGridLayout(self.baseform)
|
||||
|
@ -300,6 +304,7 @@ class ComponentTaskPanel:
|
|||
self.treeComponents.setText(0,QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeFixtures.setText(0,QtGui.QApplication.translate("Arch", "Fixtures", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeArmatures.setText(0,QtGui.QApplication.translate("Arch", "Armatures", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.treeGroup.setText(0,QtGui.QApplication.translate("Arch", "Group", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
class Component:
|
||||
"The default Arch Component object"
|
||||
|
|
|
@ -57,7 +57,8 @@ Presets = [None,
|
|||
["Plywood 18mm, 1220 x 2440",1200,2400,18],
|
||||
["Plywood 25mm, 1220 x 2440",1200,2400,25],
|
||||
["MDF 3mm, 900 x 600", 900, 600, 3],
|
||||
["MDF 6mm, 900 x 600", 900, 600, 6]]
|
||||
["MDF 6mm, 900 x 600", 900, 600, 6],
|
||||
["OSB 18mm, 1200 x 2400", 1200,2400,18]]
|
||||
|
||||
def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name="Panel"):
|
||||
'''makePanel([obj],[length],[width],[thickness],[placement]): creates a
|
||||
|
@ -67,7 +68,8 @@ def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name="Pan
|
|||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
obj.Label = translate("Arch",name)
|
||||
_Panel(obj)
|
||||
_ViewProviderPanel(obj.ViewObject)
|
||||
if FreeCAD.GuiUp:
|
||||
_ViewProviderPanel(obj.ViewObject)
|
||||
if baseobj:
|
||||
obj.Base = baseobj
|
||||
obj.Base.ViewObject.hide()
|
||||
|
@ -93,13 +95,37 @@ def makePanelView(panel,page=None,name="PanelView"):
|
|||
page.Template = Draft.getParam("template",FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg')
|
||||
view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython",name)
|
||||
page.addObject(view)
|
||||
_PanelView(view)
|
||||
PanelView(view)
|
||||
view.Source = panel
|
||||
view.Label = translate("Arch","View of")+" "+panel.Name
|
||||
view.Label = translate("Arch","View of")+" "+panel.Label
|
||||
return view
|
||||
|
||||
|
||||
class _CommandPanel:
|
||||
def makePanelCut(panel,name="PanelView"):
|
||||
"""makePanelCut(panel) : Creates a 2D view of the given panel
|
||||
in the 3D space, positioned at the origin."""
|
||||
view = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
PanelCut(view)
|
||||
view.Source = panel
|
||||
view.Label = translate("Arch","View of")+" "+panel.Label
|
||||
if FreeCAD.GuiUp:
|
||||
ViewProviderPanelCut(view.ViewObject)
|
||||
return view
|
||||
|
||||
|
||||
def makePanelSheet(panels=[],name="PanelSheet"):
|
||||
"""makePanelSheet([panels]) : Creates a sheet with the given panel cuts
|
||||
in the 3D space, positioned at the origin."""
|
||||
sheet = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
PanelSheet(sheet)
|
||||
if panels:
|
||||
sheet.Group = panels
|
||||
if FreeCAD.GuiUp:
|
||||
ViewProviderPanelSheet(sheet.ViewObject)
|
||||
return sheet
|
||||
|
||||
|
||||
class CommandPanel:
|
||||
"the Arch Panel command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Panel',
|
||||
|
@ -264,6 +290,59 @@ class _CommandPanel:
|
|||
self.rotated = not self.rotated
|
||||
|
||||
|
||||
class CommandPanelCut:
|
||||
"the Arch Panel Cut command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Panel_Cut',
|
||||
'MenuText': QT_TRANSLATE_NOOP("Arch_Panel_Cut","Panel Cut"),
|
||||
'Accel': "P, C",
|
||||
'ToolTip': QT_TRANSLATE_NOOP("Arch_Panel_Sheet","Creates 2D views of selected panels")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
if FreeCADGui.Selection.getSelection():
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Panel Cut")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
for obj in FreeCADGui.Selection.getSelection():
|
||||
if Draft.getType(obj) == "Panel":
|
||||
FreeCADGui.doCommand("Arch.makePanelCut(FreeCAD.ActiveDocument."+obj.Name+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
class CommandPanelSheet:
|
||||
"the Arch Panel Sheet command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Panel_Sheet',
|
||||
'MenuText': QT_TRANSLATE_NOOP("Arch_Panel_Sheet","Panel Sheet"),
|
||||
'Accel': "P, S",
|
||||
'ToolTip': QT_TRANSLATE_NOOP("Arch_Panel_Sheet","Creates a 2D sheet which can contain panel cuts")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Panel Sheet")))
|
||||
FreeCADGui.addModule("Arch")
|
||||
if FreeCADGui.Selection.getSelection():
|
||||
l = "["
|
||||
for obj in FreeCADGui.Selection.getSelection():
|
||||
l += "FreeCAD.ActiveDocument."+obj.Name+","
|
||||
l += "]"
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
FreeCADGui.doCommand("__objs__ = "+l)
|
||||
FreeCADGui.doCommand("Arch.makePanelSheet(__objs__)")
|
||||
FreeCADGui.doCommand("del __objs__")
|
||||
else:
|
||||
FreeCADGui.doCommand("Arch.makePanelSheet()")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
|
||||
class _Panel(ArchComponent.Component):
|
||||
"The Panel object"
|
||||
def __init__(self,obj):
|
||||
|
@ -485,7 +564,7 @@ class _ViewProviderPanel(ArchComponent.ViewProviderComponent):
|
|||
return ":/icons/Arch_Panel_Tree.svg"
|
||||
|
||||
|
||||
class _PanelView:
|
||||
class PanelView:
|
||||
"A Drawing view for Arch Panels"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -559,5 +638,328 @@ class _PanelView:
|
|||
def setDisplayMode(self,mode):
|
||||
return mode
|
||||
|
||||
|
||||
class PanelCut(Draft._DraftObject):
|
||||
"A flat, 2D view of an Arch Panel"
|
||||
|
||||
def __init__(self, obj):
|
||||
Draft._DraftObject.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyLink","Source","Arch",QT_TRANSLATE_NOOP("App::Property","The linked object"))
|
||||
obj.addProperty("App::PropertyString","TagText","Arch",QT_TRANSLATE_NOOP("App::Property","The text to display. Can be %tag%, %label% or %description% to display the panel tag or label"))
|
||||
obj.addProperty("App::PropertyLength","TagSize","Arch",QT_TRANSLATE_NOOP("App::Property","The size of the tag text"))
|
||||
obj.addProperty("App::PropertyVector","TagPosition","Arch",QT_TRANSLATE_NOOP("App::Property","The position of the tag text. Keep (0,0,0) for automatic center position"))
|
||||
obj.addProperty("App::PropertyAngle","TagRotation","Arch",QT_TRANSLATE_NOOP("App::Property","The rotation of the tag text"))
|
||||
obj.addProperty("App::PropertyFile","FontFile","Arch",QT_TRANSLATE_NOOP("App::Property","The font of the tag text"))
|
||||
obj.Proxy = self
|
||||
self.Type = "PanelCut"
|
||||
obj.TagText = "%tag%"
|
||||
obj.TagSize = 10
|
||||
obj.FontFile = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetString("FontFile","")
|
||||
|
||||
def execute(self, obj):
|
||||
pl = obj.Placement
|
||||
if obj.Source:
|
||||
base = None
|
||||
if Draft.getType(obj.Source) == "Panel":
|
||||
import Part,DraftGeomUtils
|
||||
baseobj = None
|
||||
if obj.Source.CloneOf:
|
||||
baseobj = obj.Source.CloneOf.Base
|
||||
if obj.Source.Base:
|
||||
baseobj = obj.Source.Base
|
||||
if baseobj:
|
||||
if baseobj.isDerivedFrom("Part::Feature"):
|
||||
if baseobj.Shape.Solids:
|
||||
return
|
||||
else:
|
||||
base = Part.makeCompound(baseobj.Shape.Wires)
|
||||
n = None
|
||||
for w in base.Wires:
|
||||
n = DraftGeomUtils.getNormal(w)
|
||||
if n:
|
||||
break
|
||||
if not n:
|
||||
n = Vector(0,0,1)
|
||||
base.translate(base.Vertexes[0].Point.negative())
|
||||
r = FreeCAD.Rotation(n,Vector(0,0,1))
|
||||
base.rotate(Vector(0,0,0),r.Axis,math.degrees(r.Angle))
|
||||
elif baseobj.isDerivedFrom("Mesh::Feature"):
|
||||
return
|
||||
else:
|
||||
l2 = obj.Source.Length/2
|
||||
w2 = obj.Source.Width/2
|
||||
v1 = Vector(-l2,-w2,0)
|
||||
v2 = Vector(l2,-w2,0)
|
||||
v3 = Vector(l2,w2,0)
|
||||
v4 = Vector(-l2,w2,0)
|
||||
base = Part.makePolygon([v1,v2,v3,v4,v1])
|
||||
if base:
|
||||
self.outline = base
|
||||
if obj.FontFile and obj.TagText and obj.TagSize.Value:
|
||||
if obj.TagPosition.Length == 0:
|
||||
pos = base.BoundBox.Center
|
||||
else:
|
||||
pos = obj.TagPosition
|
||||
if obj.TagText == "%tag%":
|
||||
string = obj.Source.Tag
|
||||
elif obj.TagText == "%label%":
|
||||
string = obj.Source.Label
|
||||
elif obj.TagText == "%description%":
|
||||
string = obj.Source.Description
|
||||
else:
|
||||
string = obj.TagText
|
||||
chars = []
|
||||
for char in Part.makeWireString(string,obj.FontFile,obj.TagSize.Value,0):
|
||||
chars.extend(char)
|
||||
textshape = Part.Compound(chars)
|
||||
textshape.translate(pos.sub(textshape.BoundBox.Center))
|
||||
textshape.rotate(textshape.BoundBox.Center,Vector(0,0,1),obj.TagRotation.Value)
|
||||
self.tag = textshape
|
||||
base = Part.Compound([base,textshape])
|
||||
else:
|
||||
base = Part.Compound([base])
|
||||
obj.Shape = base
|
||||
obj.Placement = pl
|
||||
|
||||
|
||||
class ViewProviderPanelCut(Draft._ViewProviderDraft):
|
||||
"a view provider for the panel cut object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
Draft._ViewProviderDraft.__init__(self,vobj)
|
||||
vobj.addProperty("App::PropertyLength","Margin","Arch",QT_TRANSLATE_NOOP("App::Property","A margin inside the boundary"))
|
||||
vobj.addProperty("App::PropertyBool","ShowMargin","Arch",QT_TRANSLATE_NOOP("App::Property","Turns the display of the margin on/off"))
|
||||
|
||||
def attach(self,vobj):
|
||||
Draft._ViewProviderDraft.attach(self,vobj)
|
||||
from pivy import coin
|
||||
self.coords = coin.SoCoordinate3()
|
||||
self.lineset = coin.SoLineSet()
|
||||
self.lineset.numVertices.setValue(-1)
|
||||
lineStyle = coin.SoDrawStyle()
|
||||
lineStyle.linePattern = 0x0f0f
|
||||
self.color = coin.SoBaseColor()
|
||||
self.switch = coin.SoSwitch()
|
||||
sep = coin.SoSeparator()
|
||||
self.switch.whichChild = -1
|
||||
sep.addChild(self.color)
|
||||
sep.addChild(lineStyle)
|
||||
sep.addChild(self.coords)
|
||||
sep.addChild(self.lineset)
|
||||
self.switch.addChild(sep)
|
||||
vobj.Annotation.addChild(self.switch)
|
||||
self.onChanged(vobj,"ShowMargin")
|
||||
self.onChanged(vobj,"LineColor")
|
||||
|
||||
def onChanged(self,vobj,prop):
|
||||
if prop in ["Margin","ShowMargin"]:
|
||||
if hasattr(vobj,"Margin") and hasattr(vobj,"ShowMargin"):
|
||||
if (vobj.Margin.Value > 0) and vobj.Object.Shape and vobj.ShowMargin:
|
||||
self.lineset.numVertices.setValue(-1)
|
||||
if vobj.Object.Shape.Wires:
|
||||
d = 0
|
||||
dw = None
|
||||
for w in vobj.Object.Shape.Wires:
|
||||
if w.BoundBox.DiagonalLength > d:
|
||||
d = w.BoundBox.DiagonalLength
|
||||
dw = w
|
||||
if dw:
|
||||
ow = dw.makeOffset2D(vobj.Margin.Value)
|
||||
verts = []
|
||||
for v in ow.OrderedVertexes:
|
||||
v = vobj.Object.Placement.inverse().multVec(v.Point)
|
||||
verts.append((v.x,v.y,v.z))
|
||||
if dw.isClosed():
|
||||
verts.append(verts[0])
|
||||
self.coords.point.setValues(verts)
|
||||
self.lineset.numVertices.setValue(len(verts))
|
||||
self.switch.whichChild = 0
|
||||
else:
|
||||
self.switch.whichChild = -1
|
||||
elif prop == "LineColor":
|
||||
if hasattr(vobj,"LineColor"):
|
||||
c = vobj.LineColor
|
||||
self.color.rgb.setValue(c[0],c[1],c[2])
|
||||
Draft._ViewProviderDraft.onChanged(self,vobj,prop)
|
||||
|
||||
def updateData(self,obj,prop):
|
||||
if prop in ["Shape"]:
|
||||
self.onChanged(obj.ViewObject,"Margin")
|
||||
Draft._ViewProviderDraft.updateData(self,obj,prop)
|
||||
|
||||
|
||||
class PanelSheet(Draft._DraftObject):
|
||||
"A collection of Panel cuts under a sheet"
|
||||
|
||||
def __init__(self, obj):
|
||||
Draft._DraftObject.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyLinkList","Group","Arch",QT_TRANSLATE_NOOP("App::Property","The linked Panel cuts"))
|
||||
obj.addProperty("App::PropertyString","TagText","Arch",QT_TRANSLATE_NOOP("App::Property","The tag text to display"))
|
||||
obj.addProperty("App::PropertyLength","TagSize","Arch",QT_TRANSLATE_NOOP("App::Property","The size of the tag text"))
|
||||
obj.addProperty("App::PropertyVector","TagPosition","Arch",QT_TRANSLATE_NOOP("App::Property","The position of the tag text. Keep (0,0,0) for automatic center position"))
|
||||
obj.addProperty("App::PropertyAngle","TagRotation","Arch",QT_TRANSLATE_NOOP("App::Property","The rotation of the tag text"))
|
||||
obj.addProperty("App::PropertyFile","FontFile","Arch",QT_TRANSLATE_NOOP("App::Property","The font of the tag text"))
|
||||
obj.addProperty("App::PropertyLength","Width","Arch",QT_TRANSLATE_NOOP("App::Property","The width of the sheet"))
|
||||
obj.addProperty("App::PropertyLength","Height","Arch",QT_TRANSLATE_NOOP("App::Property","The height of the sheet"))
|
||||
obj.addProperty("App::PropertyPercent","FillRatio","Arch",QT_TRANSLATE_NOOP("App::Property","The fill ratio of this sheet"))
|
||||
obj.Proxy = self
|
||||
self.Type = "PanelSheet"
|
||||
obj.TagSize = 10
|
||||
obj.Width = 1000
|
||||
obj.Height = 1000
|
||||
obj.FontFile = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetString("FontFile","")
|
||||
obj.setEditorMode("FillRatio",2)
|
||||
|
||||
def execute(self, obj):
|
||||
import Part
|
||||
pl = obj.Placement
|
||||
if obj.Width.Value and obj.Height.Value:
|
||||
l2 = obj.Width.Value/2
|
||||
w2 = obj.Height.Value/2
|
||||
v1 = Vector(-l2,-w2,0)
|
||||
v2 = Vector(l2,-w2,0)
|
||||
v3 = Vector(l2,w2,0)
|
||||
v4 = Vector(-l2,w2,0)
|
||||
base = Part.makePolygon([v1,v2,v3,v4,v1])
|
||||
self.sheetborder = base
|
||||
wires = []
|
||||
area = obj.Width.Value * obj.Height.Value
|
||||
subarea = 0
|
||||
for v in obj.Group:
|
||||
if v.isDerivedFrom("Part::Feature"):
|
||||
wires.extend(v.Shape.Wires)
|
||||
if Draft.getType(v) == "PanelCut":
|
||||
if v.Source:
|
||||
subarea += v.Source.Area.Value
|
||||
else:
|
||||
for w in v.Shape.Wires:
|
||||
if w.isClosed():
|
||||
f = Part.Face(w)
|
||||
subarea += f.Area
|
||||
if wires:
|
||||
base = Part.Compound([base]+wires)
|
||||
if obj.FontFile and obj.TagText and obj.TagSize.Value:
|
||||
chars = []
|
||||
for char in Part.makeWireString(obj.TagText,obj.FontFile,obj.TagSize.Value,0):
|
||||
chars.extend(char)
|
||||
textshape = Part.Compound(chars)
|
||||
textshape.translate(obj.TagPosition)
|
||||
textshape.rotate(textshape.BoundBox.Center,Vector(0,0,1),obj.TagRotation.Value)
|
||||
self.sheettag = textshape
|
||||
base = Part.Compound([base,textshape])
|
||||
obj.Shape = base
|
||||
obj.Placement = pl
|
||||
obj.FillRatio = int((subarea/area)*100)
|
||||
|
||||
|
||||
class ViewProviderPanelSheet(Draft._ViewProviderDraft):
|
||||
"a view provider for the panel sheet object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
Draft._ViewProviderDraft.__init__(self,vobj)
|
||||
vobj.addProperty("App::PropertyLength","Margin","Arch",QT_TRANSLATE_NOOP("App::Property","A margin inside the boundary"))
|
||||
vobj.addProperty("App::PropertyBool","ShowMargin","Arch",QT_TRANSLATE_NOOP("App::Property","Turns the display of the margin on/off"))
|
||||
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/Draft_Drawing.svg"
|
||||
|
||||
def setEdit(self,vobj,mode):
|
||||
if mode == 0:
|
||||
taskd = SheetTaskPanel(vobj.Object)
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
return False
|
||||
|
||||
def unsetEdit(self,vobj,mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return False
|
||||
|
||||
def attach(self,vobj):
|
||||
Draft._ViewProviderDraft.attach(self,vobj)
|
||||
from pivy import coin
|
||||
self.coords = coin.SoCoordinate3()
|
||||
self.lineset = coin.SoLineSet()
|
||||
self.lineset.numVertices.setValue(-1)
|
||||
lineStyle = coin.SoDrawStyle()
|
||||
lineStyle.linePattern = 0x0f0f
|
||||
self.color = coin.SoBaseColor()
|
||||
self.switch = coin.SoSwitch()
|
||||
sep = coin.SoSeparator()
|
||||
self.switch.whichChild = -1
|
||||
sep.addChild(self.color)
|
||||
sep.addChild(lineStyle)
|
||||
sep.addChild(self.coords)
|
||||
sep.addChild(self.lineset)
|
||||
self.switch.addChild(sep)
|
||||
vobj.Annotation.addChild(self.switch)
|
||||
self.onChanged(vobj,"ShowMargin")
|
||||
self.onChanged(vobj,"LineColor")
|
||||
|
||||
def onChanged(self,vobj,prop):
|
||||
if prop in ["Margin","ShowMargin"]:
|
||||
if hasattr(vobj,"Margin") and hasattr(vobj,"ShowMargin"):
|
||||
if (vobj.Margin.Value > 0) and (vobj.Margin.Value < vobj.Object.Width.Value/2) and (vobj.Margin.Value < vobj.Object.Height.Value/2):
|
||||
l2 = vobj.Object.Width.Value/2
|
||||
w2 = vobj.Object.Height.Value/2
|
||||
v = vobj.Margin.Value
|
||||
v1 = (-l2+v,-w2+v,0)
|
||||
v2 = (l2-v,-w2+v,0)
|
||||
v3 = (l2-v,w2-v,0)
|
||||
v4 = (-l2+v,w2-v,0)
|
||||
self.coords.point.setValues([v1,v2,v3,v4,v1])
|
||||
self.lineset.numVertices.setValue(5)
|
||||
if vobj.ShowMargin:
|
||||
self.switch.whichChild = 0
|
||||
else:
|
||||
self.switch.whichChild = -1
|
||||
elif prop == "LineColor":
|
||||
if hasattr(vobj,"LineColor"):
|
||||
c = vobj.LineColor
|
||||
self.color.rgb.setValue(c[0],c[1],c[2])
|
||||
Draft._ViewProviderDraft.onChanged(self,vobj,prop)
|
||||
|
||||
def updateData(self,obj,prop):
|
||||
if prop in ["Width","Height"]:
|
||||
self.onChanged(obj.ViewObject,"Margin")
|
||||
Draft._ViewProviderDraft.updateData(self,obj,prop)
|
||||
|
||||
|
||||
class SheetTaskPanel(ArchComponent.ComponentTaskPanel):
|
||||
|
||||
def __init__(self,obj):
|
||||
ArchComponent.ComponentTaskPanel.__init__(self)
|
||||
self.obj = obj
|
||||
self.optwid = QtGui.QWidget()
|
||||
self.optwid.setWindowTitle(QtGui.QApplication.translate("Arch", "Tools", None, QtGui.QApplication.UnicodeUTF8))
|
||||
lay = QtGui.QVBoxLayout(self.optwid)
|
||||
self.editButton = QtGui.QPushButton(self.optwid)
|
||||
self.editButton.setIcon(QtGui.QIcon(":/icons/Draft_Edit.svg"))
|
||||
self.editButton.setText(QtGui.QApplication.translate("Arch", "Edit views positions", None, QtGui.QApplication.UnicodeUTF8))
|
||||
lay.addWidget(self.editButton)
|
||||
QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.editNodes)
|
||||
self.form = [self.form,self.optwid]
|
||||
|
||||
def editNodes(self):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
FreeCADGui.runCommand("Draft_Edit")
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('Arch_Panel',_CommandPanel())
|
||||
|
||||
class CommandPanelGroup:
|
||||
|
||||
def GetCommands(self):
|
||||
return tuple(['Arch_Panel','Arch_Panel_Cut','Arch_Panel_Sheet'])
|
||||
def GetResources(self):
|
||||
return { 'MenuText': QT_TRANSLATE_NOOP("Arch_PanelTools",'Panel tools'),
|
||||
'ToolTip': QT_TRANSLATE_NOOP("Arch_PanelTools",'Panel tools')
|
||||
}
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
FreeCADGui.addCommand('Arch_Panel',CommandPanel())
|
||||
FreeCADGui.addCommand('Arch_Panel_Cut',CommandPanelCut())
|
||||
FreeCADGui.addCommand('Arch_Panel_Sheet',CommandPanelSheet())
|
||||
FreeCADGui.addCommand('Arch_PanelTools', CommandPanelGroup())
|
||||
|
|
|
@ -37,7 +37,7 @@ class ArchWorkbench(Workbench):
|
|||
"Arch_Floor","Arch_Building","Arch_Site",
|
||||
"Arch_Window","Arch_Roof","Arch_Axis",
|
||||
"Arch_SectionPlane","Arch_Space","Arch_Stairs",
|
||||
"Arch_Panel","Arch_Equipment",
|
||||
"Arch_PanelTools","Arch_Equipment",
|
||||
"Arch_Frame","Arch_Material","Arch_Schedule","Arch_PipeTools",
|
||||
"Arch_CutPlane","Arch_Add","Arch_Remove","Arch_Survey"]
|
||||
self.utilities = ["Arch_Component","Arch_SplitMesh","Arch_MeshToShape",
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
<file>icons/Arch_Panel.svg</file>
|
||||
<file>icons/Arch_Panel_Tree.svg</file>
|
||||
<file>icons/Arch_Panel_Clone.svg</file>
|
||||
<file>icons/Arch_Panel_Cut.svg</file>
|
||||
<file>icons/Arch_Panel_Sheet.svg</file>
|
||||
<file>icons/Arch_Equipment.svg</file>
|
||||
<file>icons/Arch_Equipment_Tree.svg</file>
|
||||
<file>icons/Arch_Equipment_Clone.svg</file>
|
||||
|
|
139
src/Mod/Arch/Resources/icons/Arch_Panel_Cut.svg
Normal file
139
src/Mod/Arch/Resources/icons/Arch_Panel_Cut.svg
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="64px"
|
||||
height="64px"
|
||||
id="svg2985"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="Arch_Panel_Cut.svg">
|
||||
<defs
|
||||
id="defs2987">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-112.13043 : 39.996274 : 1"
|
||||
inkscape:vp_y="-647.82872 : 891.65974 : 0"
|
||||
inkscape:vp_z="68.033808 : 168.47525 : 1"
|
||||
inkscape:persp3d-origin="-54.115626 : 58.687664 : 1"
|
||||
id="perspective3082" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-83.766798 : 112.35991 : 1"
|
||||
inkscape:vp_y="-693.60675 : 856.53301 : 0"
|
||||
inkscape:vp_z="96.397444 : 240.83889 : 1"
|
||||
inkscape:persp3d-origin="-25.75199 : 131.0513 : 1"
|
||||
id="perspective2993" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-56.67589 : 60.541728 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_z="125.67018 : 63.747989 : 1"
|
||||
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
|
||||
id="perspective2993-4" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-46.892514 : 61.217294 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="95.652941 : 64.126385 : 1"
|
||||
inkscape:persp3d-origin="26.74385 : 38.914263 : 1"
|
||||
id="perspective2993-7" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-49.818182 : 58.545455 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="92.727273 : 61.454546 : 1"
|
||||
inkscape:persp3d-origin="23.818182 : 36.242424 : 1"
|
||||
id="perspective2993-3" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-56.67589 : 60.541728 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_z="125.67018 : 63.747989 : 1"
|
||||
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
|
||||
id="perspective2993-9" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-194.65743 : 117.57652 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_z="141.87045 : 144.60095 : 1"
|
||||
inkscape:persp3d-origin="-57.915345 : 87.358818 : 1"
|
||||
id="perspective2993-0" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-99.221344 : 76.178092 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_z="237.30654 : 103.20253 : 1"
|
||||
inkscape:persp3d-origin="37.520737 : 45.960393 : 1"
|
||||
id="perspective4189" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-99.221344 : 76.178092 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_z="237.30654 : 103.20253 : 1"
|
||||
inkscape:persp3d-origin="37.520737 : 45.960393 : 1"
|
||||
id="perspective4191" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="-83.766798 : 112.35991 : 1"
|
||||
inkscape:vp_y="-693.60675 : 856.53301 : 0"
|
||||
inkscape:vp_z="96.397444 : 240.83889 : 1"
|
||||
inkscape:persp3d-origin="-25.75199 : 131.0513 : 1"
|
||||
id="perspective2993-5" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.5"
|
||||
inkscape:cx="7.4137981"
|
||||
inkscape:cy="26.653834"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1051"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:object-paths="false"
|
||||
inkscape:object-nodes="true" />
|
||||
<metadata
|
||||
id="metadata2990">
|
||||
<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>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<g
|
||||
id="g3223-6"
|
||||
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<g
|
||||
id="g3237-6"
|
||||
style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffc900;fill-opacity:1;fill-rule:evenodd;stroke:#473400;stroke-width:0.86404806;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="M 9.0917969 11.734375 L 9.0917969 51.726562 L 27.976562 51.726562 L 27.976562 44.615234 L 37.751953 44.615234 L 37.751953 51.726562 L 56.636719 51.726562 L 56.636719 11.734375 L 37.751953 11.734375 L 37.751953 18.177734 L 27.976562 18.177734 L 27.976562 11.734375 L 9.0917969 11.734375 z M 13.455078 16.097656 L 23.613281 16.097656 L 23.613281 18.177734 A 4.3640729 4.3640729 0 0 0 27.976562 22.541016 L 37.751953 22.541016 A 4.3640729 4.3640729 0 0 0 42.115234 18.177734 L 42.115234 16.097656 L 52.273438 16.097656 L 52.273438 47.363281 L 42.115234 47.363281 L 42.115234 44.615234 A 4.3640729 4.3640729 0 0 0 37.751953 40.251953 L 27.976562 40.251953 A 4.3640729 4.3640729 0 0 0 23.613281 44.615234 L 23.613281 47.363281 L 13.455078 47.363281 L 13.455078 16.097656 z "
|
||||
id="path4207" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.6 KiB |
484
src/Mod/Arch/Resources/icons/Arch_Panel_Sheet.svg
Normal file
484
src/Mod/Arch/Resources/icons/Arch_Panel_Sheet.svg
Normal file
|
@ -0,0 +1,484 @@
|
|||
<?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="64px"
|
||||
height="64px"
|
||||
id="svg2816"
|
||||
version="1.1"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="Arch_Panel_Sheet.svg">
|
||||
<defs
|
||||
id="defs2818">
|
||||
<linearGradient
|
||||
id="linearGradient3633">
|
||||
<stop
|
||||
style="stop-color:#fff652;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3635" />
|
||||
<stop
|
||||
style="stop-color:#ffbf00;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3637" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
id="perspective2824" />
|
||||
<inkscape:perspective
|
||||
id="perspective3622"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3622-9"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3653"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3675"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3697"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3720"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3742"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3764"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3785"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3806"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3806-3"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3835"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3614"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3614-8"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3643"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3643-3"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3672"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3672-5"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3701"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3701-8"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3746"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
patternTransform="matrix(0.67643728,-0.81829155,2.4578314,1.8844554,-26.450606,18.294947)"
|
||||
id="pattern5231"
|
||||
xlink:href="#Strips1_1-4"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective5224"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
id="Strips1_1-4"
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
|
||||
height="1"
|
||||
width="2"
|
||||
patternUnits="userSpaceOnUse"
|
||||
inkscape:collect="always">
|
||||
<rect
|
||||
id="rect4483-4"
|
||||
height="2"
|
||||
width="1"
|
||||
y="-0.5"
|
||||
x="0"
|
||||
style="fill:black;stroke:none" />
|
||||
</pattern>
|
||||
<inkscape:perspective
|
||||
id="perspective5224-9"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,39.618381,8.9692804)"
|
||||
id="pattern5231-4"
|
||||
xlink:href="#Strips1_1-6"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective5224-3"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
id="Strips1_1-6"
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
|
||||
height="1"
|
||||
width="2"
|
||||
patternUnits="userSpaceOnUse"
|
||||
inkscape:collect="always">
|
||||
<rect
|
||||
id="rect4483-0"
|
||||
height="2"
|
||||
width="1"
|
||||
y="-0.5"
|
||||
x="0"
|
||||
style="fill:black;stroke:none" />
|
||||
</pattern>
|
||||
<pattern
|
||||
patternTransform="matrix(0.66513382,-1.0631299,2.4167603,2.4482973,-49.762569,2.9546807)"
|
||||
id="pattern5296"
|
||||
xlink:href="#pattern5231-3"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective5288"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,-26.336284,10.887197)"
|
||||
id="pattern5231-3"
|
||||
xlink:href="#Strips1_1-4-3"
|
||||
inkscape:collect="always" />
|
||||
<pattern
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
id="Strips1_1-4-3"
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
|
||||
height="1"
|
||||
width="2"
|
||||
patternUnits="userSpaceOnUse"
|
||||
inkscape:collect="always">
|
||||
<rect
|
||||
id="rect4483-4-6"
|
||||
height="2"
|
||||
width="1"
|
||||
y="-0.5"
|
||||
x="0"
|
||||
style="fill:black;stroke:none" />
|
||||
</pattern>
|
||||
<pattern
|
||||
patternTransform="matrix(0.42844886,-0.62155849,1.5567667,1.431396,27.948414,13.306456)"
|
||||
id="pattern5330"
|
||||
xlink:href="#Strips1_1-9"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective5323"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<pattern
|
||||
inkscape:stockid="Stripes 1:1"
|
||||
id="Strips1_1-9"
|
||||
patternTransform="matrix(0.66772843,-1.0037085,2.4261878,2.3114548,3.4760987,3.534923)"
|
||||
height="1"
|
||||
width="2"
|
||||
patternUnits="userSpaceOnUse"
|
||||
inkscape:collect="always">
|
||||
<rect
|
||||
id="rect4483-3"
|
||||
height="2"
|
||||
width="1"
|
||||
y="-0.5"
|
||||
x="0"
|
||||
style="fill:black;stroke:none" />
|
||||
</pattern>
|
||||
<inkscape:perspective
|
||||
id="perspective5361"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective5383"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective5411"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3633"
|
||||
id="linearGradient3639"
|
||||
x1="2.1348772"
|
||||
y1="30.84375"
|
||||
x2="59.66058"
|
||||
y2="30.84375"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<inkscape:perspective
|
||||
id="perspective3082"
|
||||
inkscape:persp3d-origin="-54.115626 : 58.687664 : 1"
|
||||
inkscape:vp_z="68.033808 : 168.47525 : 1"
|
||||
inkscape:vp_y="-647.82872 : 891.65974 : 0"
|
||||
inkscape:vp_x="-112.13043 : 39.996274 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993"
|
||||
inkscape:persp3d-origin="-25.75199 : 131.0513 : 1"
|
||||
inkscape:vp_z="96.397444 : 240.83889 : 1"
|
||||
inkscape:vp_y="-693.60675 : 856.53301 : 0"
|
||||
inkscape:vp_x="-83.766798 : 112.35991 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-4"
|
||||
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
|
||||
inkscape:vp_z="125.67018 : 63.747989 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_x="-56.67589 : 60.541728 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-7"
|
||||
inkscape:persp3d-origin="26.74385 : 38.914263 : 1"
|
||||
inkscape:vp_z="95.652941 : 64.126385 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="-46.892514 : 61.217294 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-3"
|
||||
inkscape:persp3d-origin="23.818182 : 36.242424 : 1"
|
||||
inkscape:vp_z="92.727273 : 61.454546 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="-49.818182 : 58.545455 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-9"
|
||||
inkscape:persp3d-origin="37.520737 : 35.960393 : 1"
|
||||
inkscape:vp_z="125.67018 : 63.747989 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_x="-56.67589 : 60.541728 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-0"
|
||||
inkscape:persp3d-origin="-57.915345 : 87.358818 : 1"
|
||||
inkscape:vp_z="141.87045 : 144.60095 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_x="-194.65743 : 117.57652 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective4189"
|
||||
inkscape:persp3d-origin="37.520737 : 45.960393 : 1"
|
||||
inkscape:vp_z="237.30654 : 103.20253 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_x="-99.221344 : 76.178092 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective4191"
|
||||
inkscape:persp3d-origin="37.520737 : 45.960393 : 1"
|
||||
inkscape:vp_z="237.30654 : 103.20253 : 1"
|
||||
inkscape:vp_y="0 : 1102.1522 : 0"
|
||||
inkscape:vp_x="-99.221344 : 76.178092 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective2993-5"
|
||||
inkscape:persp3d-origin="-25.75199 : 131.0513 : 1"
|
||||
inkscape:vp_z="96.397444 : 240.83889 : 1"
|
||||
inkscape:vp_y="-693.60675 : 856.53301 : 0"
|
||||
inkscape:vp_x="-83.766798 : 112.35991 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.4999999"
|
||||
inkscape:cx="-9.5939302"
|
||||
inkscape:cy="25.339864"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:object-paths="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1051"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata2821">
|
||||
<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>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
style="opacity:0.5814504;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.58820009;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m 4.9289772,11.923295 0,43.062499 40.2187508,0 15.71875,-14.53125 0,-28.531249 -55.9375008,0 z"
|
||||
id="rect3731-9" />
|
||||
<path
|
||||
style="color:#000000;fill:url(#linearGradient3639);fill-opacity:1;fill-rule:nonzero;stroke:#372400;stroke-width:1.58820008999999995;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
d="m 2.9289772,9.3125 0,43.0625 40.2187508,0 15.71875,-14.53125 0,-28.53125 -55.9375008,0 z"
|
||||
id="rect3731" />
|
||||
<path
|
||||
style="fill:#ffb300;stroke:#372400;stroke-width:1.55999993999999997;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;fill-opacity:1"
|
||||
d="M 43.147728,52.375 58.866478,37.84375 48.181821,33.999999 43.147728,52.375 z"
|
||||
id="path3736"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
id="layer1-6"
|
||||
transform="matrix(0.71480746,0,0,0.71480746,0.050028,8.3947152)"
|
||||
style="fill:#000000;fill-opacity:1;stroke:none">
|
||||
<g
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
id="g3223-6" />
|
||||
<g
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
id="g3237-6" />
|
||||
<path
|
||||
id="path4207"
|
||||
d="m 9.0917969,11.734375 0,39.992187 18.8847651,0 0,-7.111328 9.775391,0 0,7.111328 18.884766,0 0,-39.992187 -18.884766,0 0,6.443359 -9.775391,0 0,-6.443359 -18.8847651,0 z m 4.3632811,4.363281 10.158203,0 0,2.080078 a 4.3640729,4.3640729 0 0 0 4.363281,4.363282 l 9.775391,0 a 4.3640729,4.3640729 0 0 0 4.363281,-4.363282 l 0,-2.080078 10.158204,0 0,31.265625 -10.158204,0 0,-2.748047 a 4.3640729,4.3640729 0 0 0 -4.363281,-4.363281 l -9.775391,0 a 4.3640729,4.3640729 0 0 0 -4.363281,4.363281 l 0,2.748047 -10.158203,0 0,-31.265625 z"
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.86404806;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 19 KiB |
|
@ -581,8 +581,10 @@ def getMovableChildren(objectslist,recursive=True):
|
|||
with all child objects that have a "MoveWithHost" property set to True. If
|
||||
recursive is True, all descendents are considered, otherwise only direct children.'''
|
||||
added = []
|
||||
if not isinstance(objectslist,list):
|
||||
objectslist = [objectslist]
|
||||
for obj in objectslist:
|
||||
if not (getType(obj) in ["Clone","SectionPlane"]):
|
||||
if not (getType(obj) in ["Clone","SectionPlane","Facebinder"]):
|
||||
# objects that should never move their children
|
||||
children = obj.OutList
|
||||
if hasattr(obj,"Proxy"):
|
||||
|
@ -2708,6 +2710,8 @@ def clone(obj,delta=None):
|
|||
cl.Placement = obj[0].Placement
|
||||
try:
|
||||
cl.Role = base.Role
|
||||
cl.Description = base.Description
|
||||
cl.Tag = base.Tag
|
||||
except:
|
||||
pass
|
||||
return cl
|
||||
|
@ -3563,6 +3567,8 @@ class _ViewProviderDraft:
|
|||
objs.extend(self.Object.Objects)
|
||||
if hasattr(self.Object,"Components"):
|
||||
objs.extend(self.Object.Components)
|
||||
if hasattr(self.Object,"Group"):
|
||||
objs.extend(self.Object.Group)
|
||||
return objs
|
||||
|
||||
class _ViewProviderDraftAlt(_ViewProviderDraft):
|
||||
|
|
|
@ -3501,6 +3501,16 @@ class Edit(Modifier):
|
|||
if self.pl:
|
||||
p = self.pl.multVec(p)
|
||||
self.editpoints.append(p)
|
||||
elif Draft.getType(self.obj) == "PanelCut":
|
||||
if self.obj.TagPosition.Length == 0:
|
||||
pos = self.obj.Shape.BoundBox.Center
|
||||
else:
|
||||
pos = self.pl.multVec(self.obj.TagPosition)
|
||||
self.editpoints.append(pos)
|
||||
elif Draft.getType(self.obj) == "PanelSheet":
|
||||
self.editpoints.append(self.pl.multVec(self.obj.TagPosition))
|
||||
for o in self.obj.Group:
|
||||
self.editpoints.append(self.pl.multVec(o.Placement.Base))
|
||||
if Draft.getType(self.obj) != "BezCurve":
|
||||
self.trackers = []
|
||||
if self.editpoints:
|
||||
|
@ -3724,6 +3734,14 @@ class Edit(Modifier):
|
|||
nodes = self.obj.Nodes
|
||||
nodes[self.editing] = self.invpl.multVec(v)
|
||||
self.obj.Nodes = nodes
|
||||
elif Draft.getType(self.obj) == "PanelCut":
|
||||
if self.editing == 0:
|
||||
self.obj.TagPosition = self.invpl.multVec(v)
|
||||
elif Draft.getType(self.obj) == "PanelSheet":
|
||||
if self.editing == 0:
|
||||
self.obj.TagPosition = self.invpl.multVec(v)
|
||||
else:
|
||||
self.obj.Group[self.editing-1].Placement.Base = self.invpl.multVec(v)
|
||||
|
||||
def numericInput(self,v,numy=None,numz=None):
|
||||
'''this function gets called by the toolbar
|
||||
|
|
|
@ -1548,6 +1548,9 @@ def insert(filename,docname):
|
|||
getDXFlibs()
|
||||
if dxfReader:
|
||||
groupname = os.path.splitext(os.path.basename(filename))[0]
|
||||
if isinstance(groupname,unicode):
|
||||
import sys #workaround since newDocument currently can't handle unicode filenames
|
||||
groupname = groupname.encode(sys.getfilesystemencoding())
|
||||
importgroup = doc.addObject("App::DocumentObjectGroup",groupname)
|
||||
importgroup.Label = decodeName(groupname)
|
||||
processdxf(doc,filename)
|
||||
|
@ -1642,7 +1645,7 @@ def getSplineSegs(edge):
|
|||
points.append(edge.valueAt(edge.LastParameter))
|
||||
return points
|
||||
|
||||
def getWire(wire,nospline=False,lw=True):
|
||||
def getWire(wire,nospline=False,lw=True,asis=False):
|
||||
"returns an array of dxf-ready points and bulges from a wire"
|
||||
def fmt(v,b=0.0):
|
||||
if lw:
|
||||
|
@ -1651,32 +1654,35 @@ def getWire(wire,nospline=False,lw=True):
|
|||
else:
|
||||
# Polyline format
|
||||
return ((v.x,v.y,v.z),None,[None,None],b)
|
||||
edges = Part.__sortEdges__(wire.Edges)
|
||||
points = []
|
||||
# print("processing wire ",wire.Edges)
|
||||
for edge in edges:
|
||||
v1 = edge.Vertexes[0].Point
|
||||
if DraftGeomUtils.geomType(edge) == "Circle":
|
||||
# polyline bulge -> negative makes the arc go clockwise
|
||||
angle = edge.LastParameter-edge.FirstParameter
|
||||
bul = math.tan(angle/4)
|
||||
#if cross1[2] < 0:
|
||||
if asis:
|
||||
points = [fmt(v.Point) for v in wire.OrderedVertexes]
|
||||
else:
|
||||
edges = Part.__sortEdges__(wire.Edges)
|
||||
# print("processing wire ",wire.Edges)
|
||||
for edge in edges:
|
||||
v1 = edge.Vertexes[0].Point
|
||||
if DraftGeomUtils.geomType(edge) == "Circle":
|
||||
# polyline bulge -> negative makes the arc go clockwise
|
||||
#bul = -bul
|
||||
if edge.Curve.Axis.dot(FreeCAD.Vector(0,0,1)) < 0:
|
||||
bul = -bul
|
||||
points.append(fmt(v1,bul))
|
||||
elif (DraftGeomUtils.geomType(edge) in ["BSplineCurve","BezierCurve","Ellipse"]) and (not nospline):
|
||||
spline = getSplineSegs(edge)
|
||||
spline.pop()
|
||||
for p in spline:
|
||||
points.append(fmt(p))
|
||||
else:
|
||||
points.append(fmt(v1))
|
||||
if not DraftGeomUtils.isReallyClosed(wire):
|
||||
v = edges[-1].Vertexes[-1].Point
|
||||
points.append(fmt(v))
|
||||
# print("wire verts: ",points)
|
||||
angle = edge.LastParameter-edge.FirstParameter
|
||||
bul = math.tan(angle/4)
|
||||
#if cross1[2] < 0:
|
||||
# polyline bulge -> negative makes the arc go clockwise
|
||||
#bul = -bul
|
||||
if edge.Curve.Axis.dot(FreeCAD.Vector(0,0,1)) < 0:
|
||||
bul = -bul
|
||||
points.append(fmt(v1,bul))
|
||||
elif (DraftGeomUtils.geomType(edge) in ["BSplineCurve","BezierCurve","Ellipse"]) and (not nospline):
|
||||
spline = getSplineSegs(edge)
|
||||
spline.pop()
|
||||
for p in spline:
|
||||
points.append(fmt(p))
|
||||
else:
|
||||
points.append(fmt(v1))
|
||||
if not DraftGeomUtils.isReallyClosed(wire):
|
||||
v = edges[-1].Vertexes[-1].Point
|
||||
points.append(fmt(v))
|
||||
# print("wire verts: ",points)
|
||||
return points
|
||||
|
||||
def getBlock(sh,obj,lwPoly=False):
|
||||
|
@ -1685,35 +1691,43 @@ def getBlock(sh,obj,lwPoly=False):
|
|||
writeShape(sh,obj,block,lwPoly)
|
||||
return block
|
||||
|
||||
def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
||||
def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False,layer=None,color=None,asis=False):
|
||||
"writes the object's shape contents in the given dxf object"
|
||||
processededges = []
|
||||
if not layer:
|
||||
layer=getGroup(ob)
|
||||
if not color:
|
||||
color = getACI(ob)
|
||||
for wire in sh.Wires: # polylines
|
||||
for e in wire.Edges:
|
||||
if asis:
|
||||
edges = wire.Edges
|
||||
else:
|
||||
edges = Part.__sortEdges__(wire.Edges)
|
||||
for e in edges:
|
||||
processededges.append(e.hashCode())
|
||||
if (len(wire.Edges) == 1) and (DraftGeomUtils.geomType(wire.Edges[0]) == "Circle"):
|
||||
center, radius, ang1, ang2 = getArcData(wire.Edges[0])
|
||||
if center != None:
|
||||
if len(wire.Edges[0].Vertexes) == 1: # circle
|
||||
dxfobject.append(dxfLibrary.Circle(center, radius,
|
||||
color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
color=color,
|
||||
layer=layer))
|
||||
else: # arc
|
||||
dxfobject.append(dxfLibrary.Arc(center, radius,
|
||||
ang1, ang2, color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
ang1, ang2, color=color,
|
||||
layer=layer))
|
||||
else:
|
||||
if (lwPoly):
|
||||
if hasattr(dxfLibrary,"LwPolyLine"):
|
||||
dxfobject.append(dxfLibrary.LwPolyLine(getWire(wire,nospline), [0.0,0.0],
|
||||
int(DraftGeomUtils.isReallyClosed(wire)), color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
dxfobject.append(dxfLibrary.LwPolyLine(getWire(wire,nospline,asis=asis), [0.0,0.0],
|
||||
int(DraftGeomUtils.isReallyClosed(wire)), color=color,
|
||||
layer=layer))
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("LwPolyLine support not found. Please delete dxfLibrary.py from your FreeCAD user directory to force auto-update\n")
|
||||
else :
|
||||
dxfobject.append(dxfLibrary.PolyLine(getWire(wire,nospline,lw=False), [0.0,0.0,0.0],
|
||||
int(DraftGeomUtils.isReallyClosed(wire)), color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
dxfobject.append(dxfLibrary.PolyLine(getWire(wire,nospline,lw=False,asis=asis), [0.0,0.0,0.0],
|
||||
int(DraftGeomUtils.isReallyClosed(wire)), color=color,
|
||||
layer=layer))
|
||||
if len(processededges) < len(sh.Edges): # lone edges
|
||||
loneedges = []
|
||||
for e in sh.Edges:
|
||||
|
@ -1726,16 +1740,16 @@ def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
|||
c = DraftGeomUtils.getCircleFromSpline(edge)
|
||||
if c:
|
||||
dxfobject.append(dxfLibrary.Circle(DraftVecUtils.tup(c.Curve.Center), c.Curve.Radius,
|
||||
color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
color=color,
|
||||
layer=layer))
|
||||
else:
|
||||
points = []
|
||||
spline = getSplineSegs(edge)
|
||||
for p in spline:
|
||||
points.append(((p.x,p.y,p.z),None,[None,None],0.0))
|
||||
dxfobject.append(dxfLibrary.PolyLine(points, [0.0,0.0,0.0],
|
||||
0, color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
0, color=color,
|
||||
layer=layer))
|
||||
elif DraftGeomUtils.geomType(edge) == "Circle": # curves
|
||||
center, radius, ang1, ang2 = getArcData(edge)
|
||||
if center != None:
|
||||
|
@ -1743,12 +1757,12 @@ def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
|||
center = DraftVecUtils.tup(center)
|
||||
if len(edge.Vertexes) == 1: # circles
|
||||
dxfobject.append(dxfLibrary.Circle(center, radius,
|
||||
color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
color=color,
|
||||
layer=layer))
|
||||
else : # arcs
|
||||
dxfobject.append(dxfLibrary.Arc(center, radius,
|
||||
ang1, ang2, color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
layer=layer))
|
||||
elif DraftGeomUtils.geomType(edge) == "Ellipse": # ellipses:
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("DiscretizeEllipses",True):
|
||||
points = []
|
||||
|
@ -1756,8 +1770,8 @@ def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
|||
for p in spline:
|
||||
points.append(((p.x,p.y,p.z),None,[None,None],0.0))
|
||||
dxfobject.append(dxfLibrary.PolyLine(points, [0.0,0.0,0.0],
|
||||
0, color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
0, color=color,
|
||||
layer=layer))
|
||||
else:
|
||||
if hasattr(dxfLibrary,"Ellipse"):
|
||||
center = DraftVecUtils.tup(edge.Curve.Center)
|
||||
|
@ -1771,8 +1785,8 @@ def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
|||
dxfobject.append(dxfLibrary.Ellipse(center=center,majorAxis=major,normalAxis=norm,
|
||||
minorAxisRatio=minor,startParameter=start,
|
||||
endParameter=end,
|
||||
color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
color=color,
|
||||
layer=layer))
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning("Ellipses support not found. Please delete dxfLibrary.py from your FreeCAD user directory to force auto-update\n")
|
||||
else: # anything else is treated as lines
|
||||
|
@ -1780,10 +1794,10 @@ def writeShape(sh,ob,dxfobject,nospline=False,lwPoly=False):
|
|||
ve1=edge.Vertexes[0].Point
|
||||
ve2=edge.Vertexes[1].Point
|
||||
dxfobject.append(dxfLibrary.Line([DraftVecUtils.tup(ve1), DraftVecUtils.tup(ve2)],
|
||||
color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
color=color,
|
||||
layer=layer))
|
||||
|
||||
def writeMesh(ob,dxfobject):
|
||||
def writeMesh(ob,dxf):
|
||||
"export a shape as a polyface mesh"
|
||||
meshdata = ob.Shape.tessellate(0.5)
|
||||
# print(meshdata)
|
||||
|
@ -1794,10 +1808,52 @@ def writeMesh(ob,dxfobject):
|
|||
for f in meshdata[1]:
|
||||
faces.append([f[0]+1,f[1]+1,f[2]+1])
|
||||
# print(len(points),len(faces))
|
||||
dxfobject.append(dxfLibrary.PolyLine([points,faces], [0.0,0.0,0.0],
|
||||
dxf.append(dxfLibrary.PolyLine([points,faces], [0.0,0.0,0.0],
|
||||
64, color=getACI(ob),
|
||||
layer=getGroup(ob)))
|
||||
|
||||
def writePanelCut(ob,dxf,nospline,lwPoly,parent=None):
|
||||
if not hasattr(ob.Proxy,"outline"):
|
||||
ob.Proxy.execute(ob)
|
||||
if hasattr(ob.Proxy,"outline"):
|
||||
outl = ob.Proxy.outline
|
||||
tag = None
|
||||
if hasattr(ob.Proxy,"tag"):
|
||||
tag = ob.Proxy.tag
|
||||
if tag:
|
||||
tag.Placement = ob.Placement.multiply(tag.Placement)
|
||||
if parent:
|
||||
tag.Placement = parent.Placement.multiply(tag.Placement)
|
||||
outl.Placement = ob.Placement.multiply(outl.Placement)
|
||||
if parent:
|
||||
outl.Placement = parent.Placement.multiply(outl.Placement)
|
||||
else:
|
||||
parent = ob
|
||||
if len(outl.Wires) > 1:
|
||||
# separate outline
|
||||
d = 0
|
||||
ow = None
|
||||
for w in outl.Wires:
|
||||
if w.BoundBox.DiagonalLength > d:
|
||||
d = w.BoundBox.DiagonalLength
|
||||
ow = w
|
||||
if ow:
|
||||
inl = Part.Compound([w for w in outl.Wires if w.hashCode() != ow.hashCode()])
|
||||
outl = ow
|
||||
else:
|
||||
inl = None
|
||||
outl = outl.Wires[0]
|
||||
|
||||
writeShape(outl,parent,dxf,nospline,lwPoly,layer="Outlines",color=5)
|
||||
if inl:
|
||||
writeShape(inl,parent,dxf,nospline,lwPoly,layer="Cuts",color=4)
|
||||
if tag:
|
||||
writeShape(tag,parent,dxf,nospline,lwPoly,layer="Tags",color=2,asis=True)
|
||||
# sticky fonts can render very odd wires...
|
||||
#for w in tag.Edges:
|
||||
# pts = [(v.X,v.Y,v.Z) for v in w.Vertexes]
|
||||
# dxf.append(dxfLibrary.Line(pts,color=getACI(ob),layer="Tags"))
|
||||
|
||||
def export(objectslist,filename,nospline=False,lwPoly=False):
|
||||
"called when freecad exports a file. If nospline=True, bsplines are exported as straight segs lwPoly=True for OpenSCAD DXF"
|
||||
readPreferences()
|
||||
|
@ -1828,7 +1884,25 @@ def export(objectslist,filename,nospline=False,lwPoly=False):
|
|||
dxf = dxfLibrary.Drawing()
|
||||
for ob in exportList:
|
||||
print("processing "+str(ob.Name))
|
||||
if ob.isDerivedFrom("Part::Feature"):
|
||||
if Draft.getType(ob) == "PanelSheet":
|
||||
if not hasattr(ob.Proxy,"sheetborder"):
|
||||
ob.Proxy.execute(ob)
|
||||
sb = ob.Proxy.sheetborder
|
||||
sb.Placement = ob.Placement
|
||||
ss = ob.Proxy.sheettag
|
||||
ss.Placement = ob.Placement.multiply(ss.Placement)
|
||||
writeShape(sb,ob,dxf,nospline,lwPoly,layer="Sheets",color=1)
|
||||
writeShape(ss,ob,dxf,nospline,lwPoly,layer="SheetTags",color=1)
|
||||
for subob in ob.Group:
|
||||
if Draft.getType(subob) == "PanelCut":
|
||||
writePanelCut(subob,dxf,nospline,lwPoly,parent=ob)
|
||||
elif subob.isDerivedFrom("Part::Feature"):
|
||||
shp = subob.Shape.copy()
|
||||
shp.Placement = ob.Placement.multiply(shp.Placement)
|
||||
writeShape(shp,ob,dxf,nospline,lwPoly,layer="Outlines",color=5)
|
||||
elif Draft.getType(ob) == "PanelCut":
|
||||
writePanelCut(ob,dxf,nospline,lwPoly)
|
||||
elif ob.isDerivedFrom("Part::Feature"):
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("dxfmesh"):
|
||||
sh = None
|
||||
if not ob.Shape.isNull():
|
||||
|
|
Loading…
Reference in New Issue
Block a user