Skip to content

Commit

Permalink
Fix DXF import with no layers
Browse files Browse the repository at this point in the history
As discussed in https://forum.freecadweb.org/viewtopic.php?f=3&t=54842, if OpenSCAD creates a DXF with no layers in it, the code that is supposed to handle that in FreeCAD has a minor type error in it that prevents the import from working.
  • Loading branch information
chennes committed Jan 29, 2021
1 parent 4db83a4 commit 77d666a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Draft/importDXF.py
Expand Up @@ -2220,7 +2220,7 @@ def processdxf(document, filename, getShapes=False, reComputeFlag=True):
drawstyle = "Dashdot"
locateLayer(name, color, drawstyle)
else:
locateLayer("0", [0.0, 0.0, 0.0], "Solid")
locateLayer("0", (0.0, 0.0, 0.0), "Solid")

# Draw lines
lines = drawing.entities.get_type("line")
Expand Down
4 changes: 3 additions & 1 deletion src/Mod/OpenSCAD/OpenSCAD2Dgeom.py
Expand Up @@ -500,7 +500,9 @@ def importDXFface(filename,layer=None,doc=None):
#shapeobj.Document.removeObject(shapeobj.Name)
#groupobj[0].Document.removeObject(groupobj[0].Name)
for layer in layers: #remove everything that has been imported
layer.removeObjectsFromDocument()
removeOp = getattr(layer, "removeObjectsFromDocument", None)
if callable(removeOp):
layer.removeObjectsFromDocument()
#for obj in layer.Group:
# obj.Document.removeObject(obj.Name)
layer.Document.removeObject(layer.Name)
Expand Down

0 comments on commit 77d666a

Please sign in to comment.