Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic to set iProperty date to blank field

clutsa
Collaborator

iLogic to set iProperty date to blank field

clutsa
Collaborator
Collaborator

I had code that worked in Inv Pro 2016 and now it doesn't in Inv Pro 2018.

It removes the Engineers initials and date approved. It still runs without throwing an error but the date "1/1/1601" shows in the title block.

Public Sub Unsign()
    Dim app As Application
    Dim Exl As Object
    Dim IDW As Document
    Dim oPSet As PropertySet
    Dim oProp As Property
    
    Set app = ThisApplication
    Set IDW = app.ActiveDocument
    If Not IDW.PrintManager.Type = 50351616 Then 'if not a .idw throw message
        MsgBox ("This macro will only work on .idw files.")
        End
    End If


    Dim IPT As Document
    For Each ref In IDW.ReferencedDocuments
        If Left(ref.DisplayName, Len(ref.DisplayName) - 4) = Left(IDW.DisplayName, Len(IDW.DisplayName) - 4) Then 'IF THE MODELS PART NUMBER IS THE SAME AS THE DRAWINGS PART #
            Set IPT = ref
        End If
    Next
    
    For Each oPSet In IPT.PropertySets
        'Debug.Print (oSet.DisplayName)
        For Each oProp In oPSet
            With oProp
                Debug.Print ("   - " & .DisplayName & "(" & .PropId & ") = " & .Expression)
                If .DisplayName = "Checked by" Then .Expression = ""
                'If .DisplayName = "Date Checked" Then .Value = #1/1/1601#
                If .DisplayName = "Date Checked" Then .Expression = "1/1/1601" 'This line is what I'm looking at
                If .DisplayName = "Engr Approved by" Then .Expression = ""
                'If .DisplayName = "Date Eng Approved" Then .Value = #1/1/1601#
                If .DisplayName = "Date Eng Approved" Then .Expression = "1/1/1601"
            End With
        Next
    Next
    IDW.Update2
    'AutoPrintFunctions.FinalPrintsPETC
    'IDW.Close (True)
End Sub

I found this guy https://forums.autodesk.com/t5/inventor-customization/setting-iproperty-fields-quot-creation-time-qu... at the bottom it makes mention of an error after setting the date to 1/1/1601 but it worked in 2016 so I assumed this was fixed at some point.

 

As you can see I tried setting .value ILO .expression. I also tried a blank string but I get a "type mismatch".

Any thoughts on how I can make the date show up blank in my title block again?

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Reply
Accepted solutions (1)
1,255 Views
2 Replies
Replies (2)

pball
Advisor
Advisor
Accepted solution

It seems this is a bug in the latest 2018.3. So Autodesk needs to fix it.

 

https://forums.autodesk.com/t5/inventor-customization/bug-in-inventor-2018-3-api-uncheck-date-values...

 

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes

maxim.teleguz
Advocate
Advocate
myparam = ""

iProperties.Value("Custom", "Designer Date") = myparam
iProperties.Value("Custom", "Checker Date") = myparam
iProperties.Value("Custom", "Mech. Eng. Date") = myparam
iProperties.Value("Custom", "Elec. Eng. Date") = myparam
0 Likes