Код: Выделить всё
import win32com.client as wc
inv = wc.GetActiveObject('Inventor.Application')
inv_part_document = inv.Documents.Add(12290, inv.FileManager.GetTemplateFile(12290, 8962))
part_com_definition = inv_part_document.ComponentDefinition
sketch = part_com_definition.Sketches.Add(part_com_definition.WorkPlanes.Item(3))
tg = inv.TransientGeometry
sketch.SketchLines.AddByTwoPoints(tg.CreatePoint2d(5, 5), tg.CreatePoint2d(5, -5))
sketch.SketchLines.AddByTwoPoints(tg.CreatePoint2d(5, -5), tg.CreatePoint2d(-5, -5))
sketch.SketchLines.AddByTwoPoints(tg.CreatePoint2d(-5, -5), tg.CreatePoint2d(-5, 5))
sketch.SketchLines.AddByTwoPoints(tg.CreatePoint2d(-5, 5), tg.CreatePoint2d(-7, 8))
sketch.SketchLines.AddByTwoPoints(tg.CreatePoint2d(-7, 8), tg.CreatePoint2d(5, 5))
inv.ActiveView.GoHome()
solid_profile1 = sketch.Profiles.AddForSolid()
ext_solid_definition1 = part_com_definition.Features.ExtrudeFeatures.CreateExtrudeDefinition(solid_profile1, 20481)
ext_solid_definition1.SetDistanceExtent("10 mm", 20994)
part_com_definition.Features.ExtrudeFeatures.Add(ext_solid_definition1)
inv.ActiveView.GoHome()
Подробнее здесь: https://stackoverflow.com/questions/787 ... ith-python