Bendradius of bends from derived part

Bendradius of bends from derived part

LarsBJepsen
Advocate Advocate
280 Views
1 Reply
Message 1 of 2

Bendradius of bends from derived part

LarsBJepsen
Advocate
Advocate

I'm writing an ilogic rule that iterates tru all bends of a sheet metal part, and returns the bendradius and k-factor. I figured out how to do if sheetmetal features are used, but if the sheet metal part is derived from another part, i cant figure out how to get the bendradius for each, as the bendradius is controlled by features in the base component.

 

Any suggestions? (see ??? in buttom of code)

 

 Dim oDoc As PartDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As SheetMetalComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim oBend As Bend
    For Each oBend In oDef.Bends

		Select Case oBend.BackFaces.Item(1).CreatedByFeature.Type
	    	
			Case ObjectTypeEnum.kFaceFeatureObject 'created with Face feature
	        	Dim oFace As FaceFeature
				oFace = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oFace.BendFeature.Definition.BendRadius.ModelValue, oFace.Name)
            	MessageBox.Show(" kFactor : " & oFace.Definition.BendDefinition.UnfoldMethod.kFactor, oFace.Name)
				
	        Case ObjectTypeEnum.kFlangeFeatureObject 'created with Flange feature
	        	Dim oFlange As FlangeFeature
				oFlange = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oFlange.BendFeature.Definition.BendRadius.ModelValue, oFlange.Name)
            	MessageBox.Show(" kFactor : " & oFlange.Definition.UnfoldMethod.kFactor, oFlange.Name)
	        	
			Case ObjectTypeEnum.kContourFlangeFeatureObject 'created with Contour Flange feature
	        	Dim oFlange As ContourFlangeFeature
            	oFlange = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oFlange.BendFeature.Definition.BendRadius.ModelValue, oFlange.Name)
            	MessageBox.Show( " kFactor : " & oFlange.Definition.UnfoldMethod.kFactor, oFlange.Name)
				
			Case ObjectTypeEnum.kLoftedFlangeFeatureObject 'created with Lofted Flange feature
	        	Dim oLoft As LoftedFlangeFeature
            	oLoft = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oLoft.Definition.BendRadius.ModelValue, oLoft.Name)
            	MessageBox.Show( " kFactor : " & oLoft.Definition.UnfoldMethod.kFactor, oLoft.Name)	        	 
			
			Case ObjectTypeEnum.kBendFeatureObject 'created with Bend feature
	        	Dim oBendfeature As BendFeature
            	oBendfeature = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oBendfeature.Definition.BendRadius.ModelValue, oBendfeature.Name)
            	MessageBox.Show( " kFactor : " & oBendfeature.Definition.UnfoldMethod.kFactor, oBendfeature.Name)

			Case ObjectTypeEnum.kFoldFeatureObject 'created with Fold feature
	        	Dim oFold As FoldFeature
            	oFold = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show( " Bend radius : " & oFold.Definition.BendRadius.ModelValue, oFold.Name)
            	MessageBox.Show(" kFactor : " & oFold.Definition.UnfoldMethod.kFactor, oFold.Name)
				
			Case ObjectTypeEnum.kReferenceFeatureObject 'created with Face feature
				Dim oReference As ReferenceFeature
            	oReference = oBend.BackFaces.Item(1).CreatedByFeature
				MessageBox.Show(oReference.Name, "Title")
				
		??? MessageBox.Show(" Bend radius : " & oReference.Definition.BendRadius.ModelValue, oReference.Name)
            	MessageBox.Show(" kFactor : " & oDef.UnfoldMethod.kFactor, oReference.Name)
						        	 
	End Select

Next

 

 

0 Likes
281 Views
1 Reply
Reply (1)
Message 2 of 2

JamieVJohnson2
Collaborator
Collaborator

You can go through the ReferenceDocumentDescriptor to get the original document.

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes