Rule works, but still getting an error?!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone.
Again, I don't know coding all that much but like creating little tools for now until I know how to properly code.
I have a piece of code that works, but I still get an error message... I'm using Inventors iLogic, no other coding or so.
I know Inventors iLogic is based of VB.NET, but I don't know how the build-in coding of iLogic and VB.NET coding is exactly the same.
Currently, my problem is this piece of code:
ThisApplication.ActiveDocument.PartComponentDefinition.ClearAppearanceOverrides
The Error message I get is this:
Public member 'PartComponentDefinition' on type '_DocumentClass' not found.
Now, the code I have is that once I select the "Default" appearance in a multi-value Parameter, the code should run and if it's default appearance, it should remove all appearance overrides and be the default appearance value of the material used.
It does work and does reset the apprearance to the materials default value. Yet, I get and error message.
More info bellow:
Full code list:
'This code is to update the Cut Size, be it SHS or RHS If RH_HGTH = RH_WDTH Or RH_WDTH = RH_HGTH Then iProperties.Value("Project", "Description") = RH_WDTH & " X " & RH_WDTH & " X " & RH_WTHK & " THK SHS X " & RH_LGTH & " LG" Else iProperties.Value("Project", "Description") = RH_WDTH & " X " & RH_HGTH & " X " & RH_WTHK & " THK RHS X " & RH_LGTH & " LG" End If 'This code is to change the material of the HS section Parameter.UpdateAfterChange = True If PART_MATERIAL = "STAINLESS - 304" Then iProperties.Material = "S/S 304" Else If PART_MATERIAL = "STAINLESS - 304 2B" Then iProperties.Material = "S/S 304 2B" Else If PART_MATERIAL = "STAINLESS - 304 SATIN" Then iProperties.Material = "S/S 304 SATIN" Else If PART_MATERIAL = "MILD STEEL" Then iProperties.Material = "STEEL MILD" Else If PART_MATERIAL = "GENERIC" Then iProperties.Material = "GENERIC" End If 'This code is to change the appearance of the part Dim sName As String = "" Select Case Parameter("PART_APPEARANCE") Case "POLISHED" sName = "Semi-Polished" Case "TRANSPARENT" sName = "Clear" Case "RED" sName = "Orange-Red" Case "BLUE" sName = "Blue - Wall Paint - Glossy" Case "GREEN" sName = "Dark Green" Case "BLACK" sName = "Anodized - Black" Case "YELLOW" sName = "Yellow" Case "VIOLET" sName = "Violet" Case "DEFAULT" ' Get the current material of the part 'Dim oMaterial As Material = ThisApplication.ActiveDocument.ComponentDefinition.Material ' Reset the appearance to the default for the current material 'ThisApplication.ActiveDocument.ComponentDefinition.Appearance = oMaterial.Appearance ThisApplication.ActiveDocument.PartComponentDefinition.ClearAppearanceOverrides 'sName = "Default" End Select iProperties.PartColor = sName