Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

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

akhid.rosyidi
Contributor

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

akhid.rosyidi
Contributor
Contributor

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)

0 Likes
Reply
Accepted solutions (1)
202 Views
2 Replies
Replies (2)

Michael.Navara
Advisor
Advisor

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

0 Likes

akhid.rosyidi
Contributor
Contributor
Accepted solution

Hi @Michael.Navara 

 

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

 

Thanks.

 

0 Likes