iLogic - Return Value of Extrusion Feature

iLogic - Return Value of Extrusion Feature

e_frissell
Advocate Advocate
519 Views
5 Replies
Message 1 of 6

iLogic - Return Value of Extrusion Feature

e_frissell
Advocate
Advocate

Looking for the right iLogic method to return the value from "Extrusion1"

 

Naturally you check that it's active, but from there then what?

Try : 

If Feature.IsActive("Extrusion1") Then extrusionWidth = ? 

Catch :

MsgBox("Feature doesn't exist")

' do other stuff

End Try

 

0 Likes
Accepted solutions (1)
520 Views
5 Replies
Replies (5)
Message 3 of 6

WCrihfield
Mentor
Mentor

Hi @e_frissell.  What value of the extrude feature are you wanting to retrieve (or edit)?  That 'Feature' object that you start the 'Feature.IsActive()' iLogic snippet from, doesn't actually leave you with a direct reference to the specific feature API object, it is just a shortcut utility tool for doing a limited set of things to some features.  There is a related Feature.InventorFeature() method that can be used to get a reference to the generic PartFeature object, but it seems to me like you will want to get the ExtrudeFeature object through normal Inventor API code, instead of with that iLogic shortcut snippet.  Then you will likely have to dig into its FeatureDimensions, or Parameters, or its Definition (an ExtrudeDefinition object) to access the data you are after.  It sounds a bit like you may be looking for its Extent, which is the aspect of it that defines how far, and how the extrude feature goes away from the sketch plane.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

e_frissell
Advocate
Advocate

Thanks @WCrihfield I'm trying to write something that A) determines if the feature "Extrusion1" exists and, if it does exist, what is it's value.  The code I have naturally isn't returning what I want, 

 

Public Sub Main()
	Dim userParams = ThisDoc.Document.ComponentDefinition.Parameters.UserParameters
	Dim allParams = ThisDoc.Document.ComponentDefinition.Parameters.ModelParameters
	Dim partWidthCheck, partWidth, partWidthValue As Double
	Dim oComp As PartComponentDefinition
	oComp = ThisDoc.Document.ComponentDefinition
	
	If Feature.IsActive("Extrusion1") Then 
		extWidth = oComp.Features.ExtrudeFeatures.Item("Extrude1").FeatureDimensions
		MsgBox(extWidth)
	End If
	

 

Came across this and it seems wildly more complicated than you'd think it needs to be to just find the dimension value of Extrude1.

https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DumpFeatureInfo_Sample

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Unfortunately, that sample is not that far off.  It is actually a bit more complicated than it looks when accessing some of these things by code.  That is why those iLogic shortcut snippets are so popular, because they can let you skip a much larger, and more complicated block of code, if they offer the ability you are after...which they don't seem to in this case.  If you know ahead of time what type of Extent it is, you would not need the long Select Case block of code, but you would still likely need the part of it that deals with that one specific type of Extent.  That sample is also in VBA, instead of iLogic, but it can easily be converted to iLogic by getting rid of the 'Set' keywords in there.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

e_frissell
Advocate
Advocate

Ugh, this may be the only time I've given up on something despite having pretty much exactly what I need simply because the implementation is God awful.

 

Not sure if I'm going to pursue this but as always I appreciate the help and insight

0 Likes