Draft: DXF in/out now supports Draft Layers - fixes #1504
This commit is contained in:
parent
6f896d8f22
commit
e2b24d8606
|
@ -1078,10 +1078,10 @@ def makeEllipse(majradius,minradius,placement=None,face=True,support=None):
|
|||
FreeCAD.ActiveDocument.recompute()
|
||||
return obj
|
||||
|
||||
def makeLayer(group=None):
|
||||
def makeLayer(group=None,name="Layer"):
|
||||
'''makeLayer([group]): creates a Layer object in the given group, or in the
|
||||
active document if no group is given'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython","Layer")
|
||||
obj = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython",name)
|
||||
_Layer(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
_ViewProviderLayer(obj.ViewObject)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -286,6 +286,26 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBox">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, DXF layers will be imported as Draft layers</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Draft Layers</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>dxfUseDraftLayers</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Draft</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
|
|
|
@ -134,13 +134,16 @@ def deformat(text):
|
|||
#print "output text: ",t
|
||||
return t
|
||||
|
||||
def locateLayer(wantedLayer):
|
||||
def locateLayer(wantedLayer,color=None):
|
||||
"returns layer group and creates it if needed"
|
||||
wantedLayerName = decodeName(wantedLayer)
|
||||
for l in layers:
|
||||
if wantedLayerName==l.Label:
|
||||
return l
|
||||
newLayer = doc.addObject("App::DocumentObjectGroup",wantedLayer)
|
||||
if dxfUseDraftLayers:
|
||||
newLayer = Draft.makeLayer(name=wantedLayer)
|
||||
else:
|
||||
newLayer = doc.addObject("App::DocumentObjectGroup",wantedLayer)
|
||||
newLayer.Label = wantedLayerName
|
||||
layers.append(newLayer)
|
||||
return newLayer
|
||||
|
@ -172,7 +175,7 @@ def calcBulge(v1,bulge,v2):
|
|||
def getGroup(ob):
|
||||
"checks if the object is part of a group"
|
||||
for i in FreeCAD.ActiveDocument.Objects:
|
||||
if (i.TypeId == "App::DocumentObjectGroup"):
|
||||
if i.isDerivedFrom("App::DocumentObjectGroup"):
|
||||
for j in i.Group:
|
||||
if (j == ob):
|
||||
return i.Label
|
||||
|
@ -1828,5 +1831,6 @@ dxfImportPoints = p.GetBool("dxfImportPoints",False)
|
|||
dxfImportHatches = p.GetBool("importDxfHatches",False)
|
||||
dxfUseStandardSize = p.GetBool("dxfStdSize",False)
|
||||
dxfGetColors = p.GetBool("dxfGetOriginalColors",False)
|
||||
dxfUseDraftLayers = p.GetBool("dxfUseDraftLayers",False)
|
||||
dxfBrightBackground = isBrightBackground()
|
||||
dxfDefaultColor = getColor()
|
Loading…
Reference in New Issue
Block a user