First get the application and document,
Then get the definition (is this a part file, assembly file, or drawing file, this question changes things a bit),
Next get a sketch (get one or create a new one)
Set the sketch to edit mode
Inside the sketch, create the rectangle (several methods inside of the sketch.sketchlines)
Optionally create the constraints to the rectangle
Exit sketch edit mode
Save your work.
Sub DrawRectangle() Dim invApp As Inventor.Application invApp = ThisApplication Dim doc As Inventor.Document doc = invApp.ActiveDocument Dim cDef As ComponentDefinition cDef = doc.Definition Dim sketch As Inventor.sketch sketch = cDef.Sketches sketch.Edit Dim point1 As Point2d point1 = invApp.TransientGeometry.CreatePoint2d(0, 0) Dim point2 As Point2d point2 = invApp.TransientGeometry.CreatePoint2d(1, 1) Dim see As Object see = sketch.SketchLines.AddAsTwoPointRectangle(point1, point2) sketch.ExitEdit doc.Save End Sub