Suppress part features from assembly

Suppress part features from assembly

Anonymous
Not applicable
3,015 Views
8 Replies
Message 1 of 9

Suppress part features from assembly

Anonymous
Not applicable

is it possible to suppress features that are in a part while they are in an assembly using ilogic? for example, i want to suppress a hole based on an embedded value in an assembly spreadsheet using the go.excel value in ilogic assembly. can i do this?

0 Likes
Accepted solutions (1)
3,016 Views
8 Replies
Replies (8)
Message 2 of 9

johnsonshiue
Community Manager
Community Manager

Hi! You could suppress the feature in the part at the assembly level.  However, the feature in the part will be suppressed. But, if you want two show the assembly with the feature suppressed and the feature unsuppressed at the same time, you will need to have two separate datasets. You cannot use one set of files to represent two geometric state. I guess you are attempting SWX's Configuration workflow in INV. For this particular case (suppressing/unsuppressing part feature), the closest workflow will be using iPart and iAssembly.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 9

Anonymous
Not applicable

thank you johnsonas long as i just have the part once in my assembly i can suppress/unsuppress features within that part? what would the ilogic code look like for that?

0 Likes
Message 4 of 9

johnsonshiue
Community Manager
Community Manager

Hi! Please share an example of what you have. Forum experts should be able to help craft the iLogic rule. It is not about how many occurrences of the part in the given assembly. It is about a part can only have one geometric definition at one time. You cannot have two geometric definitions of the same part (ipt file). iPart achieves it by using multiple member part files driven by the iPart factory.

Your example here will go a long way to avoid confusion and you can get your questions answered precisely.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 5 of 9

Anonymous
Not applicable

that sounds great, johnson! thank you- Ii have attached the assembly and part. 

 

this is the type of code im thinking? its currently in an ilogic rule in the assembly. 

 

SyntaxEditor Code Snippet

HoleTest = GoExcel.CellValue("3rd Party:Embedding 1", "Sheet1", "B1")

ExtrudeTest = GoExcel.CellValue("3rd Party:Embedding 1", "Sheet1", "B2")

' If HoleTest = "NO"
	' Suppress the hole feature from testpart
'Else If HoleTest = "YES"
	' Unsuppress the hole feature from testpart	
	
' If ExtrudeTest = "NO"
	'Suppress the extrude feature from testpart
'Else If ExtrudeTest = "YES"
	' Unsuppress the extrude feature from testpart	
	
InventorVb.DocumentUpdate(True)

thank you!

0 Likes
Message 6 of 9

Yijiang.Cai
Autodesk
Autodesk

@Anonymous, I am using Inventor 2019, and please see the attached files. I do not embed the excel file in the assembly, and just locate the excel file in the same location with Inventor file. Please see the code line, and hope it helpful for you.

 

Dim HoleTest As String
HoleTest=GoExcel.CellValue("Test.xlsx", "Sheet1", "B1")

Dim ExtrudeTest As String
ExtrudeTest = GoExcel.CellValue("Test.xlsx", "Sheet1", "B2")

If UCase(HoleTest) = "NO" Then
Feature.IsActive("testpart:1", "Hole1") = True
ElseIf UCase(HoleTest) = "YES" Then
Feature.IsActive("testpart:1", "Hole1") = False
End If

If UCase(ExtrudeTest) = "NO" Then
Feature.IsActive("testpart:1", "Extrusion1") = True
ElseIf UCase(ExtrudeTest) = "YES" Then
Feature.IsActive("testpart:1", "Extrusion1") = False
End If

InventorVb.DocumentUpdate(True)

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Email: River-Yijiang.Cai@autodesk.com
Message 7 of 9

JaneFan
Autodesk
Autodesk
Accepted solution

Hi @Anonymous, 

 

Not sure how you place your iPart file into assembly. If you place the iPart file into assembly as iLogic Component, then the code @Yijiang.Cai provided works well. Otherwise, if you simply place an iPart file as a common component, then we need control feature's suppression in another way: 

Change River's code a little bit: 

SyntaxEditor Code Snippet

Dim HoleTest As String
HoleTest=GoExcel.CellValue("Test.xlsx", "Sheet1", "B1")
Dim ExtrudeTest As String
ExtrudeTest = GoExcel.CellValue("Test.xlsx", "Sheet1", "B2")

Dim oOcc As ComponentOccurrence
oOcc = ThisDoc.Document .ComponentDefinition.Occurrences.ItemByName("testpart-02:1")
Dim oSubDoc As PartDocument
If oOcc.IsiPartMember = False Then
	If UCase(HoleTest) = "NO" Then
		Feature.IsActive(oOcc.Name , "Hole1") = False
	ElseIf UCase(HoleTest) = "YES" Then
		Feature.IsActive(oOcc.Name, "Hole1") = True
	End If

	If UCase(ExtrudeTest) = "NO" Then
		Feature.IsActive(oOcc.Name, "Extrusion2") = False
	ElseIf UCase(ExtrudeTest) = "YES" Then
		Feature.IsActive(oOcc.Name, "Extrusion2") = True
	End If
Else 
     oSubDoc = oOcc.ReferencedDocumentDescriptor.ReferencedDocument.ReferencedDocuments(1)
	 Dim oFeatures = oSubDoc.ComponentDefinition.Features
	 If UCase(HoleTest) = "NO" Then
		oFeatures.HoleFeatures.Item("Hole1").Suppressed  = True
	ElseIf UCase(HoleTest) = "YES" Then
		oFeatures.HoleFeatures.Item("Hole1").Suppressed  = False
	End If

	If UCase(ExtrudeTest) = "NO" Then
		oFeatures.extrudefeatures.item("Extrusion2").Suppressed = True
	ElseIf UCase(ExtrudeTest) = "YES" Then
		oFeatures.extrudefeatures.Item("Extrusion2").Suppressed  = False
	End If
End If

iLogicVb.UpdateWhenDone = True 

 




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 8 of 9

Anonymous
Not applicable

that code worked wonderfully! thank you jane!

0 Likes
Message 9 of 9

iman.qx
Participant
Participant

Hi Jane

that is a very nice piece of code. thanks for sharing it. 

I am having a problem, i thought you may have an idea to solve it. I create a code that makes a copy from an existing part in my assembly and place it in to the same assembly with the new parameters that user has put into the interface form. based on those parameter the part has be to updated meaning there is a rule in this part which suppress and unsuppress some features. when I call this rule in my code which is written in the subassembly right after the copy and place is done, I am facing an error! here I pasted the text of the error:

 

Error in rule: Suppress, in document: PP001_TT_Connection_Nozzle017.ipt

Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

looks like inventor cannot copy and update feature suppression at the same time. I don't know if that is because the file is not open by inventor or not!

but if after copying I open the part manually and run the rule, everything works fine. I need to find a way to automate this procedure. that will be kind of you if you have any idea how to proceed with that.

thanks in advance

0 Likes