Editing feature definitions after creation?

Editing feature definitions after creation?

J_Pfeifer_
Advocate Advocate
79 Views
3 Replies
Message 1 of 4

Editing feature definitions after creation?

J_Pfeifer_
Advocate
Advocate

Good morning friends, I'm running into a situation where the Topological Naming is messing up my flange editor.

 

The first thing of note there are only 3 variations of this type to be applied and modified from the model. A 2", 3" and 4" option. The 2" and 3" are both tapered while the 4" is not. All I'm attempting to do is change the size and placement of these items dynamically. or basically swap between them using form inputs. 

 

The issue is, the OD of the 4" situation is larger than the bottom of my model (bottom radius cannot be changed). Adding a face to the combine cut that's used to cut this and the gusset features. It then breaks my shell feature unable to calculate the proper faces for the shell. 

Sub main()
	
	Dim App As Inventor.Application = ThisApplication
	Dim oDoc As PartDocument = App.ActiveDocument
	Dim CompDef As PartComponentDefinition = oDoc.ComponentDefinition
	Dim oTO As TransientObjects = App.TransientObjects
	
	Dim oParams As Inventor.UserParameters = CompDef.Parameters.UserParameters
	
	Dim oShell As ShellFeature = CompDef.Features.ShellFeatures.Item("F2 Shell feature")
	Dim oShellDef As ShellDefinition = oShell.Definition
	
	Dim oCombine As CombineFeature = CompDef.Features.CombineFeatures.Item("F2 combine")

	Dim FaceCol As FaceCollection = oTO.CreateFaceCollection
	
	For Each iFace As Face In oCombine.Faces
		If iFace.Evaluator.Area < 1 Then 
			FaceCol.Add(iFace)
		End If 
	Next
	
	oShell.SetEndOfPart(True)
	
	For Each iFace As Face In FaceCol
		oShellDef.InputFaces.Add(iFace)
	Next
	
	CompDef.SetEndOfPartToTopOrBottom(False)


	

End Sub

 

The above code has been modified multiple times in an attempt to suppress, move end of part, specify different faces, clear the face collection and more. This includes confirming that the face that's claim to be missing, has already been loaded into the collection. Or at least the Evaluator.area is the same. 

 

Attached are two photos. One shows the 2 + 3" layout, while the other shows the 4". I've circled the face messing this up in red, in blue I've pointed out the seam creating the face issue. 

 

Any held would be greatly appreciated!

 

0 Likes
80 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_Waguespack
Consultant
Consultant

@J_Pfeifer_ , your code looks right to me, other than: should this be greater than < rather then > than ? Maybe not? I might be misinterpreting the intent 

 

		If iFace.Evaluator.Area < 1 Then 
			FaceCol.Add(iFace)
		End If 

 

EESignature

0 Likes
Message 3 of 4

J_Pfeifer_
Advocate
Advocate

This was an If I threw into the loop due to already logging and checking the values with measure. The face being added is .811 area. The code provided has changed multiple times with different logs and otherwise. This is just the state I happened to copy it for a question. 

 

I cant really tell what's happening at the feature definition. I've logged the count before clearing the input faces. I've tried adding faces to the collection. The log after still claims the same amount of faces in the collection. Then I read that some of the definitions are in read only after the creation of the feature. To which I attempted to suppress the feature to no avail. Then I moved the end of part above disabling the feature still no luck. 

 

I know that the program side does not function the same as the manual inputs, however If i edit the feature. I can select that small circle, click ok, and the feature solves correctly.

 

All of this to say, anything I seem to do to the .inputfaces does not take effect on the feature. 

 

 

0 Likes
Message 4 of 4

Curtis_Waguespack
Consultant
Consultant

@J_Pfeifer_ 

It should be read/write according to this

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=ShellFeature_Definition

Also, on second glance, it looks like the InputFaces is just the faces to remove, maybe? See examples for creating a new shell.

Curtis_Waguespack_0-1758302349951.png

 

Dim oDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection
Dim oBody As SurfaceBody
Dim oFace As Inventor.Face
Dim oShellFeats As ShellFeatures
Dim oShellDef As ShellDefinition
Dim oShelllFeat As ShellFeature
Dim oThickness As Double = .1

oShellFeats = oPDef.Features.ShellFeatures

' just for testing
Try
oShelllFeat = oShellFeats.Item("MyShell")
oShelllFeat.Delete 
Catch
End Try

oBody = oPDef.SurfaceBodies.Item(1)
oFace = oBody.Faces.Item(2)
oFaces.Add(oFace)
oShellFeats = oPDef.Features.ShellFeatures
oShellDef = oShellFeats.CreateShellDefinition(oFaces, oThickness, ShellDirectionEnum.kInsideShellDirection)
oShelllFeat = oShellFeats.Add(oShellDef)
oShelllFeat.Name = "MyShell"



This example specifies no faces

Curtis_Waguespack_1-1758302400149.png

Dim oDoc As PartDocument = ThisDoc.Document
Dim oPDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection
Dim oBody As SurfaceBody
Dim oFace As Inventor.Face
Dim oShellFeats As ShellFeatures
Dim oShellDef As ShellDefinition
Dim oShelllFeat As ShellFeature
Dim oThickness As Double = .1

oShellFeats = oPDef.Features.ShellFeatures

' just for testing
Try
oShelllFeat = oShellFeats.Item("MyShell")
oShelllFeat.Delete 
Catch
End Try

oBody = oPDef.SurfaceBodies.Item(1)
'oFace = oBody.Faces.Item(2)
'oFaces.Add(oFace)
oShellFeats = oPDef.Features.ShellFeatures
oShellDef = oShellFeats.CreateShellDefinition(oFaces, oThickness, ShellDirectionEnum.kInsideShellDirection)
oShelllFeat = oShellFeats.Add(oShellDef)
oShelllFeat.Name = "MyShell"

 

EESignature

0 Likes