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

Uncheck "Checked Date" with iLogic

rikard.nilsson
Collaborator

Uncheck "Checked Date" with iLogic

rikard.nilsson
Collaborator
Collaborator

Hi,

 

Proir to 2018.3 we could use the following line.

iProperties.Value("Status", "Checked Date") = Nothing

But now that gives an error.

Does anyone know what to use now after 2018.3 if we want to Uncheck something with a Date in Iproperties

 

 

Regards

Rikard

Reply
Accepted solutions (2)
2,128 Views
11 Replies
Replies (11)

MechMachineMan
Advisor
Advisor

Well, you could always fire up the VBA and test the properties of a file that has the date unchecked.... just an idea.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes

mr_ensing
Advocate
Advocate

I've got the exact same problem (but with VBA)!
Most of us run 2018.2, but one coworker is now running 2018.3. 

 

2018.2, build 227, 10/24/2017

2018.3, build 284, 04/14/2018

 

The system with 2018.3 cannot change the "Checked Date" setting anymore. Finding it is no problem, reading it's value also great. But when VBA tries to uncheck (by way of date 1/1/1601) it faults.

I tried a kinds of variations of the code below, but no dice. 

 

Private Sub TestDateChecked()
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument
    oDoc.PropertySets.Item("Design Tracking Properties").Item("Date Checked").Value = "1601, 1, 1"
End Sub

mr_ensing
Advocate
Advocate

I can still change to a random date without problems. But unchecking the value results in an error.

Unchecking used to (and still does for 2018.2) work by changing the date to 1/1/1601.

If there is a new way, i would love to learn.

0 Likes

GeorgK
Advisor
Advisor
Accepted solution

rikard.nilsson
Collaborator
Collaborator

Hi!

 

Thank you soo much for this!!

So adding the time was the difference from what i tested with..

 

Regards

Rikard

0 Likes

mr_ensing
Advocate
Advocate

Instant update:

The conclusion below is true for:  Build: 284, Release: 2018.3 - Date: Sat 04/14/2018

It fails on: Build: 284, Release: 2018.3.3 - Date: Thu 10/25/2018 (it sets the checked date to 1/1/1601)

/Instant update

 

For me (in VBA) this date/time works: "01-01-1601 01:00:00"

If i create a date and set it to #01-01-1601 01:00:00#, VBA auto-changes it to #1/1/1601 1:00:00 AM#, which works as well.

So below are the 2 ways:

 

Private Sub TestDateChecked()
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument
    oDoc.PropertySets.Item("Design Tracking Properties").Item("Date Checked").Value = "01-01-1601 01:00:00"
Dim NullDate As Date NullDate = #1/1/1601 1:00:00 AM# oDoc.PropertySets.Item("Design Tracking Properties").Item("Date Checked").Value = NullDate End Sub

 

0 Likes

mr_ensing
Advocate
Advocate
Accepted solution

A bit of experimenting later, and the situation seems to be as following:

 

For 2018.3: "01-01-1601 01:00:00"

For 2018.3.3: "01-01-1601 0:00:01"

 

No time to roll back at the moment. Production work first.

0 Likes

mr_ensing
Advocate
Advocate

So, i tested 3 versions of IV2018. Below are the date/time combinations that work to uncheck the Checked Date property.

 

Build: 227, Release: 2018.2 - Date: Tue 10/24/2017

- "01-01-1601"

- "01-01-1601 00:00:00"

 

Build: 284, Release: 2018.3 - Date: Sat 04/14/2018

- "01-01-1601 01:00:00"

 

Build: 284, Release: 2018.3.3 - Date: Thu 10/25/2018

- "01-01-1601 00:00:01"

 

The last thing i want, is to create different versions of my macro for the different builds of Inventor.

 

0 Likes

GeorgK
Advisor
Advisor

@Anonymous

 

This should be immediately fixed for all Inventor versions!

mr_ensing
Advocate
Advocate

I created a function to deal with these differences. It returns True/False to let the main sub know if it succeeded or not (and de main sub can log an error).

 

It's a terrible hack, but it's tested on 2018.2, 2018.3 and 2018.3.3. So i hope to be done with it.

 

VBA code:

Sub TestTheDamnThing()
    Dim pDoc As Document
    Set pDoc = ThisApplication.ActiveDocument
    If IsDateUnChecked(pDoc.PropertySets) Then
        MsgBox ("It works!")
    Else
        MsgBox ("It failed!")
    End If
End Sub

Function IsDateUnChecked(ByRef oPropSets As PropertySets) As Boolean
    Dim oCheckedDateProp As Property
    Set oCheckedDateProp = oPropSets.Item("Design Tracking Properties").Item("Date Checked")
    IsDateUnChecked = False
    
    Dim DatesArray(2) As String
    DatesArray(0) = "01-01-1601 00:00:00"   'works for 2018.2
    DatesArray(1) = "01-01-1601 01:00:00"   'works for 2018.3
    DatesArray(2) = "01-01-1601 00:00:01"   'works for 2018.3.3
    
    Dim i As Integer
    For i = LBound(DatesArray) To UBound(DatesArray)
        If oCheckedDateProp.Value = #1/1/1601# Then
            IsDateUnChecked = True
            Exit Function
        End If
        On Error Resume Next
            oCheckedDateProp.Value = DatesArray(i)
        On Error GoTo 0
    Next i
End Function

 

It seems that, if the right value is set, and the property is unchecked, it saves the value as: #1/1/1601#.

Only the date, no time. So i check against that value to see if i succeeded.

0 Likes

mr_ensing
Advocate
Advocate

A bit more testing and some minor changes:

 

Function IsDateUnChecked(ByRef oPropSets As PropertySets) As Boolean
    Dim oCheckedDateProp As Property
    Set oCheckedDateProp = oPropSets.Item("Design Tracking Properties").Item("Date Checked")
    IsDateUnChecked = False
    
    Dim DatesArray(2) As Date
    DatesArray(0) = #1/1/1601#              'works for 2018.2 AND 2018.3.3
    DatesArray(1) = "01-01-1601 01:00:00"   'works for 2018.3
    DatesArray(2) = "01-01-1601 00:00:01"   'works for 2018.3.3 (keep for backup)
    
    Dim i As Integer
    For i = LBound(DatesArray) To UBound(DatesArray)
        If oCheckedDateProp.Value = #1/1/1601# Then
            IsDateUnChecked = True
            Exit Function
        End If
        On Error Resume Next
            oCheckedDateProp.Value = DatesArray(i)
        On Error GoTo 0
    Next i
End Function
0 Likes