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

How Can I Change The Name of Features and Sketches Usin Logic

Hello Everyone,

 

I came across this great post about renaming features in a part using iLogic (code below is from the solution of this post.) I was hoping to take it a step further to include other features, iFeatures and sketches.  Adjusting the code to update other features is pretty straight forward but, I am running into issues when I try to get iFeatures and/or sketches to rename.  I think this is due to my limited knowledge of code. 

 

Here is the Code I'm working with;

 

oDoc = ThisApplication.ActiveDocument
oBodies = oDoc.ComponentDefinition.SurfaceBodies

'look at the bodies
For Each oBody In oBodies
	i = 1
	'look at all the features that make up the body
	For Each oFeature In oBody.AffectedByFeatures
		'look at only extrude features
		If oFeature.Type = ObjectTypeEnum.kExtrudeFeatureObject Then
			'rename feature using solid name
			'and pad the number with zero if under 10
			oFeature.Name = oBody.Name _
			& " - Ext. " &  If(i < 10, "0" + CStr(i), CStr(i))
			i = i + 1
		End If
	Next
Next

 

In the code above, I think I need to change "oFeature" and ObjectTypeEnum.kExtrudeFeatureObject.  However, I don't know what I need to change this to.

 

Any idea how I can make this work?

 

Thanks,

Paul