change of sketch name

Hi guys,

when I create a new sketch, how can I change the name of the sketch?

thanks,

john

SolidworksApi macros
Answers 3
SF
SF 2010-10-04 Best Answer

Hi John

After the create sketch, and exit. Select it and press F2.

If You want change name the feature do the same or, select in Option - FeatureManager - Name feature on creation.

after the operation, the name will be able to edit

comment imagecomment imagecomment imagecomment image
SF
SF 2010-10-04

thanks for your reply. but, what I want is to change the name in my addin programmatically.

john

IK
IK 2010-10-04

Sub main()

Dim swApp As SldWorks.SldWorks

Dim Part As SldWorks.ModelDoc2

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Part.SketchManager.InsertSketch True

Dim vSkLines As Variant

vSkLines = Part.SketchManager.CreateCornerRectangle(-0.06353895446837, 0.02724775866296, 0, 0.02196263306023, -0.02208008029585, 0)

Part.SketchManager.InsertSketch True

Dim feat As SldWorks.Feature

Set feat = Part.FeatureByPositionReverse(0)

feat.Name = "newName2"

End Sub