Draft: fixed export of invalid shapes to DXF
This commit is contained in:
parent
ff2ccdd648
commit
1843f89659
|
@ -1815,10 +1815,12 @@ def export(objectslist,filename,nospline=False,lwPoly=False):
|
||||||
for ob in exportList:
|
for ob in exportList:
|
||||||
print("processing "+str(ob.Name))
|
print("processing "+str(ob.Name))
|
||||||
if ob.isDerivedFrom("Part::Feature"):
|
if ob.isDerivedFrom("Part::Feature"):
|
||||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("dxfmesh"):
|
sh = None
|
||||||
sh = None
|
if ob.Shape.isNull():
|
||||||
if not ob.Shape.isNull():
|
print ("Null shape - skipping")
|
||||||
writeMesh(ob,dxf)
|
continue
|
||||||
|
elif FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("dxfmesh"):
|
||||||
|
writeMesh(ob,dxf)
|
||||||
elif gui and FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("dxfproject"):
|
elif gui and FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("dxfproject"):
|
||||||
direction = FreeCADGui.ActiveDocument.ActiveView.\
|
direction = FreeCADGui.ActiveDocument.ActiveView.\
|
||||||
getViewDirection().multiply(-1)
|
getViewDirection().multiply(-1)
|
||||||
|
@ -1829,29 +1831,28 @@ def export(objectslist,filename,nospline=False,lwPoly=False):
|
||||||
else:
|
else:
|
||||||
sh = ob.Shape
|
sh = ob.Shape
|
||||||
if sh:
|
if sh:
|
||||||
if not sh.isNull():
|
if sh.ShapeType == 'Compound':
|
||||||
if sh.ShapeType == 'Compound':
|
if (len(sh.Wires) == 1):
|
||||||
if (len(sh.Wires) == 1):
|
# only one wire in this compound, no lone edge -> polyline
|
||||||
# only one wire in this compound, no lone edge -> polyline
|
if (len(sh.Wires[0].Edges) == len(sh.Edges)):
|
||||||
if (len(sh.Wires[0].Edges) == len(sh.Edges)):
|
writeShape(sh,ob,dxf,nospline,lwPoly)
|
||||||
writeShape(sh,ob,dxf,nospline,lwPoly)
|
|
||||||
else:
|
|
||||||
# 1 wire + lone edges -> block
|
|
||||||
block = getBlock(sh,ob,lwPoly)
|
|
||||||
dxf.blocks.append(block)
|
|
||||||
dxf.append(dxfLibrary.Insert(name=ob.Name.upper(),
|
|
||||||
color=getACI(ob),
|
|
||||||
layer=getGroup(ob)))
|
|
||||||
else:
|
else:
|
||||||
# all other cases: block
|
# 1 wire + lone edges -> block
|
||||||
block = getBlock(sh,ob,lwPoly)
|
block = getBlock(sh,ob,lwPoly)
|
||||||
dxf.blocks.append(block)
|
dxf.blocks.append(block)
|
||||||
dxf.append(dxfLibrary.Insert(name=ob.Name.upper(),
|
dxf.append(dxfLibrary.Insert(name=ob.Name.upper(),
|
||||||
color=getACI(ob),
|
color=getACI(ob),
|
||||||
layer=getGroup(ob)))
|
layer=getGroup(ob)))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
writeShape(sh,ob,dxf,nospline,lwPoly)
|
# all other cases: block
|
||||||
|
block = getBlock(sh,ob,lwPoly)
|
||||||
|
dxf.blocks.append(block)
|
||||||
|
dxf.append(dxfLibrary.Insert(name=ob.Name.upper(),
|
||||||
|
color=getACI(ob),
|
||||||
|
layer=getGroup(ob)))
|
||||||
|
|
||||||
|
else:
|
||||||
|
writeShape(sh,ob,dxf,nospline,lwPoly)
|
||||||
|
|
||||||
elif Draft.getType(ob) == "Annotation":
|
elif Draft.getType(ob) == "Annotation":
|
||||||
# texts
|
# texts
|
||||||
|
|
Loading…
Reference in New Issue
Block a user