- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Because I have been doing a lot of work on some heavy duty rules as of late, I decided that maybe it was time to stop using so much copy / paste, and set some often used functions up in my external rules. Our company does this for a few mathematical functions that require a number of Double inputs and spits out the resulting sum (as double), so I figured it wouldn't be so bad to just tack it onto the end of said existing external rule.
The problem that I run into is that Inventor fails to recognize any of the calls to the Inventor Object Library!
As of right now, I'm not importing anything into the rule, and I know for a fact that the rule is set up as VBOnly (as it's nested inside of a module with no sub main()). Is there something that I need to do, or some way that I need to make a call so that I can use these functions from anywhere in my internal / standard rules?
The code that I would like to get working is as follows...
Public Function GetPartGroup(docAP As Inventor.Document) As String
Dim PartLocation As String
PartLocation = "Nothing"
Dim RefFile As Inventor.FileDescriptor
If docAP.File.ReferencedFileDescriptors.Count > 0 Then
RefFile = docAP.File.ReferencedFileDescriptors.Item(1)
Select Case RefFile.LocationType
Case Inventor.LocationTypeEnum.kLibraryLocation
PartLocation = "Library Part"
Case Inventor.LocationTypeEnum.kWorkspaceLocation
PartLocation = "Local Part"
Case Inventor.LocationTypeEnum.kWorkgroupLocation
PartLocation = "Remote Part"
Case Inventor.LocationTypeEnum.kUnknownLocation
PartLocation = "Unknown Location"
End Select
Return PartLocation
End If
End Function
Btw, this will take a document and tell me if it's a library / standard / or some other variant type part.
Thanks for any help.
If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

Solved! Go to Solution.
