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

Need a VBA macro for creating a single sketch, a point and use punch at the end.

Hello, 

 

I required help for performing a operation in Inventor 2014. It is repeated task.

 

I need a VBA macro for creating one sketch, a single point and use that point for punch a mark.

 

so, steps are as follows for macro. (Note - Below all steps should be in a single macro.)

1. Create Sketch (need to select face manually of sheet metal part) --> I already have one macro for the same. I can share, taken from forum.

 

2. on the same sketch, plotting a single point. Co-ordinates for point will be Introduced manually by the user.

 

3. and the last step just open punch tool window, let the user select punch and press "OK".

 

Macro for creating sketch as i said earlier : Please see if below macro can help.

__________________________________________________________________________

Public Sub NewSketchOnPlane()
Dim partDoc As PartDocument
Set partDoc = ThisApplication.ActiveDocument

' Create a new sketch on a selected face.
Dim planarEntity As Object
Set planarEntity = ThisApplication.CommandManager.Pick(kAllPlanarEntities, _
"Select a face or work plane.")
Dim sk As sketch
Set sk = partDoc.ComponentDefinition.Sketches.Add(planarEntity)

' Bring the sketch into edit mode.
sk.Edit
End Sub"

_______________________________________________________________

 

thanks in advance. Smiley Wink