As the extracted shape does not contain the contour lines, I tried a small code snippet inspired by yours to create the shape for that too:
Code: Select all
doc = App.ActiveDocument
obj = doc.getObject("Surface")
new = doc.addObject("Part::Feature", "SomeCountourShape")
new.Shape = obj.ContourShapes
Now all I have to figure out how to display the elevation of the contour lines in TechDraw, If there is no out-of-the-box solution I guess it could be done by iterating over the subshapes of the contour shape, getting the Z coordinate of the first vertex of the first edge and generating annotation. The placement of the annotation could be tricky though.