Wow, that works for you? I've tried it on 2 workstations and both crashed.
Further to that. Will I need to use FlushToFile to save the iProperty from within Inventor os is it not necessary?
So, I guess the code is ok, as I suspected, since it's not generating a normal runtime error. Where can I get some help to figure out why I'm receiving this fatal error?
I run this code with an IDW as the active document.
Thx Sean
"Sean Dotson" wrote in message news:4072fe30_1@newsprd01...
This works in an IVB for me
Public Sub UpdateIProperties()
Dim oDoc As Document
Dim i As Integer
Dim oPropsets As PropertySets
Set oDoc = ThisApplication.ActiveDocument
Set oPropsets = oDoc.PropertySets
For i = 1 To oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Count
If UCase(oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Item(i).Name) = "SCALE" Then
oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Item(i).Value = ThisApplication.ActiveDocument.Sheets(1).DrawingViews.Item(1).Scale
DoEvents
End If
Next
Set oPropsets = Nothing
End Sub
You did rememebr to have a drawing view right?
--
Sean Dotson, PE
Autodesk Inventor Certified Expert
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Mike Rand" wrote in message news:4072fc47_3@newsprd01...
Hi All,
From inside my default.ivb I am trying to update an iProperty in the DocumentChange event.
On the statement:
oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Item(i).Value = ThisApplication.ActiveDocument.Sheets(1).DrawingViews.Item(1).Scale
I receive a Pur Virtual Function Call error and Inventor crashes. I've tried creating a new drawing and installing the latest patches. I'm using version 8. Any guidance would be appreciated. My hands are tied here.
Here is my code:
Public Sub UpdateIProperties(ByRef Field As String)
Dim i As Integer
Dim oPropsets As PropertySets
Set oPropsets = ThisApplication.ActiveDocument.PropertySets
Select Case Field
Case "SCALE"
For i = 1 To oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Count
If UCase(oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Item(i).Name) = "SCALE" Then
oPropsets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}").Item(i).Value = ThisApplication.ActiveDocument.Sheets(1).DrawingViews.Item(1).Scale
DoEvents
End If
Next
Case Else
'do nothing
End Select
Set oPropsets = Nothing
End Sub