Message 1 of 2

Not applicable
10-04-2021
05:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i use this code to creat a new part , and a new sketch.
But the sketch doesn(t work, i don't understand why.
someone can help me please?
Sub test()
'Créer une nouvelle piece SHOP
Dim oApp As Inventor.Application
Set oApp = ThisApplication
oTemplatesPath = oApp.DesignProjectManager.ActiveDesignProject.TemplatesPath
oTemplateFile = "piece SHOP.ipt"
oTemplate = oTemplatesPath & "\" & oTemplateFile
Dim oPartDoc As PartDocument
Set oPartDoc = oApp.Documents.Add(kPartDocumentObject, oTemplate)
'Créer une esquisse
' Create a 2D sketch on the X-Y plane.
Dim sketch1 As PlanarSketch
Set sketch1 = oPartDoc.Sketches.Add(oPartDoc.WorkPlanes.Item(3))
Dim tg As TransientGeometry
Set tg = oApp.TransientGeometry
' Draw rectangles by center point.
Call Sketch.SketchLines.AddAsTwoPointCenteredRectangle(tg.CreatePoint2d(0, 0), tg.CreatePoint2d(8, 3))
End Sub
Solved! Go to Solution.