Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Ralf_Krieg
in reply to: Alex.Shechter

Hello

 

I  don't mean more than 99 slots per feature, but more than 99 features. If there is an feature "SL100", the code fails. Just want to say, don't except it's perfect.

For hole features you could try to count the holecenterpoints. If such a center point is positioned out of your volume and you drill "a hole in the air" this hole would even be counted.

 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oUserParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters 
Dim iCount As Integer
Dim sCount As String

' If a feature is Active (not suppressed), it is added the FeatureList array
For Each oExtrusion As ExtrudeFeature In oDoc.ComponentDefinition.Features.ExtrudeFeatures
	If oExtrusion.Name.StartsWith("SL") Then
		If Feature.IsActive(oExtrusion.Name) Then
		   sCount = Mid(oExtrusion.Name, 3)
		   If sCount.Length = 1 Then
			   sCount = "0" & sCount
		   End If
		   MsgBox("Number_of_Slots_" & sCount & ": " & oExtrusion.Definition.Profile.Count)
			Try
		   		Parameter("Number_of_Slots_" & sCount)= oExtrusion.Definition.Profile.Count
			Catch
				oUserParams.AddByExpression ("Number_of_Slots_" & sCount, oExtrusion.Definition.Profile.Count, UnitsTypeEnum.kUnitlessUnits)
			End Try
		End If
	End If
Next


For Each oHole As HoleFeature In oDoc.ComponentDefinition.Features.HoleFeatures 
	If oHole.Name.StartsWith("Hole_") Then
		If Feature.IsActive(oHole.Name) Then
		   sCount = Mid(oHole.Name, 6)
		   If sCount.Length = 1 Then
			   sCount = "0" & sCount
		   End If
		   MsgBox("Number_of_Holes_" & sCount & ": " & oHole.HoleCenterPoints.Count)
			Try
		   		Parameter("Number_of_Holes_" & sCount)= oHole.HoleCenterPoints .Count
			Catch
				oUserParams.AddByExpression ("Number_of_Holes_" & sCount, oHole.HoleCenterPoints.Count, UnitsTypeEnum.kUnitlessUnits)
			End Try
		End If
	End If
Next


R. Krieg
RKW Solutions
www.rkw-solutions.com