Change Face Feature Direction

Change Face Feature Direction

dalton98
Collaborator Collaborator
441 Views
6 Replies
Message 1 of 7

Change Face Feature Direction

dalton98
Collaborator
Collaborator

I'm wanting to create a rule that will always make 'Face1' extrude in the negative direction. It throws an error when I try to change the direction. Anyone know why?

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oSM As PartComponentDefinition
oSM = oDoc.ComponentDefinition

Dim oFace As FaceFeature
oFace = oSM.Features.Item("Face1")

MessageBox.Show(oFace.Definition.Direction)

oFace.Definition.Direction = 20993      '<---- error
'oFace.Definition.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection
0 Likes
442 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Hi @dalton98.  Are there any other features on the part after that Face feature?  Any sketches based on its faces?  I know that often if I attempt to go back and flip the direction of my original Face feature on a sheet metal part after I have some other features on it manually, it will also throw an error.  I guess it looses reference to specific faces and edges that were being referenced for those later features &/or sketches...or something like that.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 7

WCrihfield
Mentor
Mentor

Often things like hole features or bends also have 'directions' associated with them, and when you flip the original faces around, it reveres the directions of those features.  In the case of the hole feature, after the flip, it is no longer removing any material or effecting the model in any way, because its 'direction' is pointing away from the part's material, instead of towards it, resulting in a message that says something like "feature ... did not change the number of faces ...".

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 7

dalton98
Collaborator
Collaborator

Tried it with just a base sketch and it wouldn't work. Think I might need to get the 'FaceFeature' a different way, but idk any.

0 Likes
Message 5 of 7

WCrihfield
Mentor
Mentor

I've now tried this myself on both pre-existing sheet metal parts, and on a new simple rectangular part with no other features or sketches.  It seems that no matter how you do it, it always throws an error when flipping the face's direction, even though that property is supposed to be Read/Write.  And I've tried all 3 possible directions.  The error says "Not implemented" in every case.  Another interesting point is that if I put that last line within a Try...Catch block, that causes the error message to specify a line much further down in the code that does not exist.  (Using Inventor 2022, it specifies which line of code it encountered the error at.)

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oSMFeats As SheetMetalFeatures = oSMDef.Features
Dim oFace As FaceFeature = oSMFeats.FaceFeatures.Item("Face1")
MsgBox("Face Original Direction = " & oFace.Definition.Direction.ToString, , "")
Try
	oFace.Definition.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection
Catch oEx As Exception
	MsgBox("Flip Direction Failed!" & vbCrLf & _
	oEx.Message & vbCrLf & oEx.StackTrace,,"")
End Try

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 7

bradeneuropeArthur
Mentor
Mentor

Still the case also on Inventor 2024.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 7

WCrihfield
Mentor
Mentor

Yep.  Just tried it again myself on a simple part with only a FaceFeature, and no dependents, after seeing your reply, and get same results.  I even tried setting the 'End Of Part' to just before that feature just before setting its direction, then back to after the feature after that step, but still got same error, and same result.  Sometimes that little trick will work, but not always.  It is logical that it wouldn't work, because the feature does not exist yet when modeling history is rolled back to before it.  Plus, the FaceFeature.Definition property is not Read/Write, so we can't create a different definition, or modify its current one, then set that definition back as the value of that property afterwards.  I also tried finding the 'FeatureDimension' dictating the 'Thickness' value, and added a negative sign in front of its Parameter.Expression, but that resulted in a 'catastrophic failure' type error, and did not 'flip' its direction either.  Last resort would likely be to delete and recreate it, but if that feature has any downstream dependents, that action would most likely mess a lot of other stuff up.  So unfortunately, manually making this type of change is still the best way to deal with it at the moment.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes