Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
akhid.rosyidi
200 Views, 2 Replies

VB.Net with Inventor add ins template. Sketch creation not work.

Hi, 
I try to create small addins  for simple sketch creation, but  it not works.

new sketch already created but sketch point and circle not works.

below is my script.

your advice, please.

 

Dim oDoc As PartDocument = g_inventorApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry
'sketch Plane
Dim oPlaneXY As WorkPlane = oCompDef.WorkPlanes("ARCUCS: XY Plane")

'Create Sketch.
Dim oSketch As PlanarSketch
oSketch = oCompDef.Sketches.Add(oPlaneXY)
oSketch.Name = "ARSketchHoles2"
oSketch.Edit()

Dim xCoord As Double = 15
Dim yCoord As Double = 15
Dim radius As Double = 5

Dim o2DPoint As Point2d = oTG.CreatePoint2d(xCoord, yCoord)
Dim circle As SketchCircle = oSketch.SketchCircles.AddByCenterRadius(o2DPoint, radius)

Your code works as expected. Verify that the g_inventorApplication is defined and set. Also try to zoom all.

Hi @Michael.Navara 

 

thanks for quick respond,
it weird, my script works after I restart my laptop.

 

Thanks.