Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Drawing,FreeCAD
- from FreeCAD import Vector
- filename = "/home/danfalck/Documents/freecad/testview3.dxf"#change the file name and directory here
- FILE = open(filename,"w")
- sel = FreeCADGui.Selection.getSelection()
- page = sel[0]
- views = page.OutList
- fileout = "0\nSECTION\n2\nENTITIES\n"
- for v in views:
- shape = v.Source.Shape.copy()
- if v.Direction.z == 1:
- shape.rotate(Vector(0,0,0),Vector(0,0,1),v.Rotation)
- else:
- shape.rotate(Vector(0,0,0),Vector(v.Direction),90.0)
- if v.Direction.x == 0:
- tx = float(v.X/v.Scale); ty = float(0)
- shape.translate(Vector(tx,ty,0))
- else:
- tx = float(0); ty = float(v.Y/v.Scale)
- shape.translate(Vector(tx,ty,0))
- fileout+= Drawing.projectToDXF(shape,Vector(0,0,1))
- del shape
- fileout+="0\nENDSEC\n0\nEOF\n"
- FILE.write(fileout)
- FILE.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement