Suppress Multi Body using iLogic from Spreadsheet

Suppress Multi Body using iLogic from Spreadsheet

jfenter
Enthusiast Enthusiast
598 Views
3 Replies
Message 1 of 4

Suppress Multi Body using iLogic from Spreadsheet

jfenter
Enthusiast
Enthusiast

I'm working on a Multi Body part and want to suppress features using an Excel spreadsheet.  There are 4 features that will toggle on and off based on a given length and 1 feature that will have a variable number sketch pattern based on that same length. 


For example: 

Given Length : 1222mm
Feature 1 : Active

Feature 2 : Suppressed

Feature 3 : Pattern count 13

Feature 4 : Active

Feature 5 : Active

 

Given Length(2) : 650mm

Feature 1 : Suppressed

Feature 2 : Active

Feature 3 : Pattern count 6

Feature 4 : Active

Feature 5 : Active

 

I have the spreadsheet set up with the various lengths in column A:4 to A:46.

The feature counts are given in columns B, C, D, E and F.

 

I'm assuming I need some kind of Do Loop after declaring variables.  Thanks in advance for any help!

 

Inventor 2019

 

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

WCrihfield
Mentor
Mentor

Can you explain what I'm seeing within your spreadsheet a little more please.

It kind of looks like you're planning on using a different part or part number as the first louver in your pattern, based on assembly length.

What do the values in Cells 3B through 3F represent?

What are the (3)'s and (2)'s for in Cells 2B through 2F?

And what kind of features are we talking about here?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

jfenter
Enthusiast
Enthusiast

Yes, there will be different part numbers used in different quantities based on the overall part length.  The (2) and (3) in row 2 is just there for me as a reminder of the part feature.  These are louvered moldings for a framed door assembly and the part numbers listed in row 3 have the given number of louvers from row 2.  I've attached an updated version of the spreadsheet and a copy of a part I created using a different iLogic rule.  The length and repetitiveness of the rule will be difficult to manage in the future and I was hoping to use the spreadsheet to ease future part management.  I think by reviewing the "Door Length" rule I have created, you could probably get a better understanding of what I'm trying to achieve. 

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

OK. I think I may have something you can use for this situation.

Try the following code for your Door Length rule.  Or temporarily Suppress that rule and create another one to place this code into.

'This line is just added to automatically fire this rule every time the length Parameter changes.
oDummyVariable1 = length

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oFeatures As PartFeatures = oCompDef.Features
For Each oFeature As PartFeature In oFeatures
	If oFeature.Suppressed = False Then
		oFeature.Suppressed = True
	End If
Next

oFileName = "C:\Work\Project Data\Managed Scripts\Product Engineering\Louver Door.xlsx"
oSheetName = "Louver Door"

GoExcel.Open(oFile, oSheet)
GoExcel.DisplayAlerts = False

GoExcel.TitleRow = 3 'The Row that contains the Column Names
GoExcel.FindRowStart = 4 'The 1st Row containing Data
'Finds the row number that contains the specified data
i = GoExcel.FindRow(oFile, oSheet, "ASSEMBLY LENGTH", "=", Parameter.Param("length").Value.ToString)

oStarterLouver3 = GoExcel.CurrentRowValue("1245692").ToString
If oStarterLouver3 Is Nothing Then
ElseIf oStarterLouver3 = 1 Then
	Feature.IsActive("1245692") = True
	iProperties.Value("Custom", "Starter Profile") = "1245692"
End If

oStarterLouver2 = GoExcel.CurrentRowValue("1245782").ToString
If oStarterLouver2 Is Nothing Then
ElseIf oStarterLouver2 = 1 Then
	Feature.IsActive("1245782") = True
	iProperties.Value("Custom", "Starter Profile") = "1245782"
End If

oCenterLouver2 = GoExcel.CurrentRowValue("1245780").ToString
If oCenterLouver2 Is Nothing Then
	iProperties.Value("Custom", "Center Profile2") = "None"
ElseIf oCenterLouver2 = 1 Then
	Feature.IsActive("1245780") = True
	iProperties.Value("Custom", "Center Profile2") = "1245780"
End If

Feature.IsActive("1245690") = True
iProperties.Value("Custom", "Finish Profile2") = "1245690"
iProperties.Value("Custom", "Starter Profile") = "1245691"

oCenterLouver3 = GoExcel.CurrentRowValue("1245691").ToString
centerCount = Val(oCenterLouver3)
Dim oNum As Integer = 1
For oNum = 1 To Val(oCenterLouver3)
	Feature.IsActive("1245691:" & oNum) = True
Next

GoExcel.Close
'Output Parameters values from this rule to the Model. (Use this before Document Update)
RuleParametersOutput()
'Immediately update the current document.
InventorVb.DocumentUpdate()

This seems like a painfully complex way of doing what I'm imagining your trying to do.

Is there some reason you can't use your centerCount Parameter to drive your sketched pattern quantity of the CenterLouver3 feature.  I'm also thinking that, because of the patterns within the spreadsheet, you may be able to use mathematical means to controll this configuration, instead of an external spreadsheet. Just a thought.

I usually always work with exteranal rules instead of local rules, so if something is throwing errors about data type mismatch or something, try deleting the ".ToString", Val(), & Parameter.Param() stuff to see if it will accept that straight values.  iLogic says that the Value in these cases is an Object, instead of a String or Double or Integer, that's why I wrote those lines that way.

I hope this helps.

If this solves your problem or answers your questions, please select 'Accept As Solution'.

Or if this helps you along the way to reaching your solution, please click 'Like'.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes