help with a vba program

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Once again I am working in Inventor. Once again I am designing a casting part. I want to create two views/representations of the part - one with just the casting features and one with the casting features plus holes and extruded cuts (used for surfacing). Unfortunately, Inventor STILL doesn't have the ability to suppress features based on representations. This makes me very sad.
Before I move over to SolidWorks AGAIN, I wanted to give it one more college try.
Below is a VB code sample where I look at which viewrepresentation is active. If the casting version is active, the features are suppressed. If the machined version is active the features are unsuppressed. However, it doesn't work.
I also tried to run this as an iLogic rule, but I couldn't figure out how to set up the iTrigger.
Any help is appreciated. I can't believe we are on Release 2014 and Inventor still doesn't manage castings without using derived parts.
===================================================
Public Sub Casting_Part()
Select Case ViewRep
Case "Casting Only"
oThisCompDef.RepresentationsManager.DesignViewRepresentations.Item("Casting Only").Activate
' ***Base Mounting Hole***
Feature.IsActive("Base Mounting Hole") = False
' ***captive screw hole 1***
Feature.IsActive("captive screw hole 1") = False
' ***captive screw hole 2***
Feature.IsActive("captive screw hole 2") = False
' ***captive screw hole 3***
Feature.IsActive("captive screw hole 3") = False
' ***bottom counterbore for captive screws***
Feature.IsActive("bottom counterbore for captive screws") = False
' ***bottom counterbore for captive screws***
Feature.IsActive("bottom counterbore for captive screws") = False
' ***4-40 corner hole 1***
Feature.IsActive("4-40 corner hole 1") = False
' ***4-40 corner hole 2***
Feature.IsActive("4-40 corner hole 2") = False
' ***4-40 corner hole 3***
Feature.IsActive("4-40 corner hole 3") = False
' ***4-40 landing 1***
Feature.IsActive("4-40 landing 1") = False
' ***4-40 landing 2***
Feature.IsActive("4-40 landing 2") = False
' ***4-40 landing 3***
Feature.IsActive("4-40 landing 3") = False
' ***4-40 landing 4***
Feature.IsActive("4-40 landing 4") = False
' ***center heatsink 4-40***
Feature.IsActive("center heatsink 4-40") = False
' ***MOUNTING LANDS 2 FRONT 4-40***
Feature.IsActive("MOUNTING LANDS 2 FRONT 4-40") = False
' ***LASER LAND 2-56***
Feature.IsActive("LASER LAND 2-56") = False
Case "Surfacing and Taps"
oThisCompDef.RepresentationsManager.DesignViewRepresentations.Item("Surfacing and Taps").Activate
' ***Base Mounting Hole***
Feature.IsActive("Base Mounting Hole") = True
' ***captive screw hole 1***
Feature.IsActive("captive screw hole 1") = True
' ***captive screw hole 2***
Feature.IsActive("captive screw hole 2") = True
' ***captive screw hole 3***
Feature.IsActive("captive screw hole 3") = True
' ***bottom counterbore for captive screws***
Feature.IsActive("bottom counterbore for captive screws") = True
' ***bottom counterbore for captive screws***
Feature.IsActive("bottom counterbore for captive screws") = True
' ***4-40 corner hole 1***
Feature.IsActive("4-40 corner hole 1") = True
' ***4-40 corner hole 2***
Feature.IsActive("4-40 corner hole 2") = True
' ***4-40 corner hole 3***
Feature.IsActive("4-40 corner hole 3") = True
' ***4-40 landing 1***
Feature.IsActive("4-40 landing 1") = True
' ***4-40 landing 2***
Feature.IsActive("4-40 landing 2") = True
' ***4-40 landing 3***
Feature.IsActive("4-40 landing 3") = True
' ***4-40 landing 4***
Feature.IsActive("4-40 landing 4") = True
' ***center heatsink 4-40***
Feature.IsActive("center heatsink 4-40") = True
' ***MOUNTING LANDS 2 FRONT 4-40***
Feature.IsActive("MOUNTING LANDS 2 FRONT 4-40") = True
' ***LASER LAND 2-56***
Feature.IsActive("LASER LAND 2-56") = True
End Select
End Sub