Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. def to_dxf(the_unfold):
  2.     document = FreeCAD.ActiveDocument
  3.     unfold_object = document.addObject("Part::Feature", "Unfold")
  4.     unfold_object.Shape = the_unfold
  5.  
  6.     active_object = FreeCAD.ActiveDocument.ActiveObject
  7.     _, face = get_max_face(active_object)
  8.  
  9.     face_part = document.addObject("Part::Feature", "Unfold_Face")
  10.     face_part.Shape = face
  11.  
  12.     two_d_view = Draft.makeShape2DView(face_part, FreeCAD.Vector(face.normalAt(0, 0)[0], face.normalAt(0, 0)[1], face.normalAt(0, 0)[2]))
  13.     # The ProjectionMode attribute needs to be overwritten with the desired mode, which can be "Solid", "Individual Faces", "Cutlines", or "Cutfaces".
  14.     two_d_view.ProjectionMode = "Individual Faces"
  15.  
  16.     # importDXF.export(objectslist, filename, nospline=False, lwPoly=False)
  17.     importDXF.export([two_d_view], "Unfold_" + FreeCADGui.Selection.getSelection()[0].Label + ".dxf")
  18.     print("DXF successful!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement