iLogic code only works on certain computers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
A couple years ago, I created an iLogic code to modify the view label description in a drawing. It basically looks at the label of the last view and takes the label name along with a project iproperty and sheet number and sends that back to the status iproperty to the part. I then use this status iproperty in the view label and it is also used in the BOM to describe where to find a certain part in a drawing set. For some reason this has always worked fine on my machine but not on everyone elses machine. We did have one machine that the code just wouldn't work. It didn't give any errors, but didn't seem to do anything either. We fixed it by setting it up as an external rule, and for some reason the external rule would work when it was ran. We have now replaced that machine and another and reinstalled Inventor 2015, and now the rule will not work when it is embedded in a drawing and also will not work when used as an external rule either. The machine is basically the same as mine, they are both an HP Z420 with Xeon E5-1607 processors and 32 GB of RAM. The code is below, I'd really appreciate it if someone had some insight as to why this might not work on both machines. I'm certainly not a programmer, I found similar codes online and modified them to do what we needed it to.
Here is the code:
'start of ilogic code
Dim oDoc As DrawingDocument: oDoc = ThisDoc.Document
Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
Dim SheetNumber As String
i =1
oSheets = oDoc.Sheets
For Each oSheet In oSheets
oViews = oSheet.DrawingViews
For Each oView In oViews
'capture the current view label
ViewLabel = oView.Name
'reset the display name
oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName = ""
'get the display name
oModelName = _
oView.ReferencedDocumentDescriptor.ReferencedDocument.DisplayName
Try
'get the sheet number
SheetNumber =Mid(oSheet.Name, InStr(1, oSheet.Name, ":") + 1)
i=1+1
iProperties.Value(oModelName, "Status", "Status") = _
iProperties.Value("Project", "Project")+"-"+ViewLabel+SheetNumber
'Send view label items to models Status iProperty
'Use Status iProperty for view label
Catch
'do nothing if error
End Try
Next
iLogicVb.UpdateWhenDone = True
Next
'end of ilogic code