Can not create sketchline with API

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I don't know why I can not create a sketchline with a simple VBA programe showd below, I thouht the program statement is very easy,but it's always running fail- can not get any sketch line in active sketch view. Please tell me the reason about it. Your help will be appreciated.
Sub test2()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
If Not TypeOf ThisApplication.ActiveEditObject Is sketch Then
MsgBox "Please run it in the sketch environment."
Exit Sub
End If
Dim oSketch As DrawingSketch
Set oSketch = ThisApplication.ActiveEditObject
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Call oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(-4.2, -0.33), oTG.CreatePoint2d(-4.2, -0.225))
End Sub