Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 62 lines (49 sloc) 1.89 KB
# -*- coding: utf-8 -*-
import FreeCAD
import Draft
import importSVG
FreeCAD.open(u"C:/Users/jelson/home/mohai/base/Medallion Face Template Rev B.FCStd")
App.setActiveDocument("Medallion_Face_Template_Rev_B")
App.ActiveDocument=App.getDocument("Medallion_Face_Template_Rev_B")
doc = App.getDocument("Medallion_Face_Template_Rev_B")
# Compute list of objects in the doc before importing the SVG
beforeList = []
for obj in doc.Objects:
beforeList.append(obj.Label)
# Insert the SVG
importSVG.insert(u"C:/Users/jelson/home/mohai/tmp/curr-output.svg","Medallion_Face_Template_Rev_B")
curvesToEmboss = []
for obj in doc.Objects:
if not obj.Label in beforeList:
curvesToEmboss.append(obj)
# Create a fusion of all paths
fused_paths = doc.addObject("Part::MultiFuse", "fused-paths")
fused_paths.Shapes = curvesToEmboss
extrusion = doc.addObject("Part::Extrusion", "extrusion")
extrusion.Base = fused_paths
extrusion.DirMode = "Normal"
extrusion.DirLink = None
extrusion.LengthFwd = 0.4
extrusion.LengthRev = 0.0
extrusion.Solid = True
extrusion.Reversed = False
extrusion.Symmetric = False
extrusion.TaperAngle = 0.0
extrusion.TaperAngleRev = 0.0
fused_paths = doc.addObject("Part::MultiFuse", "fused-paths")
fused_paths.Shapes = [extrusion, doc.Body]
doc.recompute()
# Convert each curve to a sketch, deleting the sketches along the way
#sketches=[]
#for curve in curvesToEmboss:
# curveObj = doc.getObjectsByLabel(curve)
# sketches.append(Draft.makeSketch(curveObj, autoconstraints=True, delete=True))
#merged = doc.addObject('Sketcher::SketchObject', 'merged-sketch')
#for sketch in sketches:
# if hasattr(sketch, 'Geometry'):
# for geo in sketch.Geometry:
# merged.addGeometry(geo)
# doc.removeObject(sketch.Label)
#emb = doc.Body.newObject("PartDesign::Pad", "embossed-drawing")
#emb.Profile = merged
#emb.Length = 0.8