iLogic snippets to control/suppress Features in Flat Pattern?

iLogic snippets to control/suppress Features in Flat Pattern?

dans8MK94
Observer Observer
115 Views
1 Reply
Message 1 of 2

iLogic snippets to control/suppress Features in Flat Pattern?

dans8MK94
Observer
Observer

Hello,

I'm trying to suppress or unsuppress Features in a Flat Pattern depending on a condition.

Is there a code similar to something like this that exists?

FlatPattern.Feature.IsActive("BRL-01", "CutR") = False

I'm Using the "Select Case" at the moment..

 

Thanks,

D

Inventor Professional 2023

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

WCrihfield
Mentor
Mentor

Hi @dans8MK94.  No, there is no iLogic shortcut snippet for that.  But that does not mean it is not possible.  It just means it will require more code to accomplish.  The 'IsActive' phrase essentially means 'Not Suppressed'.  We do have the ability to suppress, or un-suppress features, without using using those 'Feature.IsActive' snippets.  The FlatPattern pattern of sheet metal part is like its own separate ComponentDefinition, with its own set of parameters, sketches, features, and so on.  In order to access it, we must go through the SheetMetalComponentDefinition first, then to its SheetMetalComponentDefinition.FlatPattern property, after checking the SheetMetalComponentDefinition.HasFlatPattern property value, to see if it exists yet.

 

Below is a starter code for you to work from.

 

Sub Main
	If ThisDoc.Document.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Return
	Dim oPDoc As PartDocument = ThisDoc.Document
	Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
	Dim oSMFeats As SheetMetalFeatures = oSMDef.Features
	If Not oSMDef.HasFlatPattern Then
		Try
			oSMDef.Unfold
		Catch
			MsgBox("The attempt to 'Unfold' this part failed.", , "")
			Exit Sub
		End Try
	End If
	Dim oFPatt As FlatPattern = oSMDef.FlatPattern
	Dim oFPFeats As FlatPatternFeatures = oFPatt.Features
	oFPFeats.Item("CutR").Suppressed = True 'same as IsAcive being False
End Sub

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes