Setting iProperty fields "Creation Time" & "Date Checked&q

Setting iProperty fields "Creation Time" & "Date Checked&q

Anonymous
Not applicable
1,291 Views
4 Replies
Message 1 of 5

Setting iProperty fields "Creation Time" & "Date Checked&q

Anonymous
Not applicable
Hi, has anyone run across this issue... I am trying to set the "Creation Time" and "Date Checked" property fields to be blank values?

The code below will not work, because it attempts to assign a text string to a date value, thus causing a type mismatch.

I tried doing a type conversion as follows:
oDwgProp.Value = CDate(sDwgPropAry(17)), but this still is not valid because you need a valid date format, and not a blank string.

From a "end-user" stand point, a check box will set date values to be blank.

Does anyone know if we can access this check box member via the API to set a blank date value? (or is there another method available?).

I forward a thanks!

-Kerwin

"non-working" code snippet:

For Each oStdDwgPropSet In oDwgPropSets
For Each oDwgProp In oStdDwgPropSet
Select Case oDwgProp.Name
Case "Creation Time"
oDwgProp.Value = sDwgPropAry(17)
Case "Date Checked"
oDwgProp.Value = sDwgPropAry(19)
End Select
Next oDwgProp
Next oStdDwgPropSet
0 Likes
1,292 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Property values are actually stored as
Variants.  This allows them to support multiple variable types.  In
the case of dates it is equivalent to the VB Date type.  The idea of a
blank date does not exist.  A date variable always contains a date
somewhere between Jan. 1 100 and Dec. 31, 9999.  Because there isn't a
blank date, Inventor has chosen to use a specific date to mean that no date has
been defined.  This is Jan. 1, 1601.  If you set the value of any of
the date properties to this date they will appear in the iProperties dialog with
an empty check box.  The sample below sets the date for the manufacturing
approved property to the "blank" date.

 

Private Sub PropDateTest()
   
Dim oPropSet As PropertySet
    Set oPropSet =
ThisApplication.ActiveDocument.PropertySets("{32853F0F-3444-11d1-9E93-0060B03C1CA6}")
   
Dim oProp As Property
    Set oProp =
oPropSet.ItemByPropId(kDateMfgApprovedDesignTrackingProperties)
   
oProp.Value = #1/1/1601#
End Sub

-Brian


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
has anyone run across this issue... I am trying to set the "Creation Time" and
"Date Checked" property fields to be blank values?

The code below will not work, because it attempts to assign a text string
to a date value, thus causing a type mismatch.

I tried doing a type conversion as follows:
oDwgProp.Value =
CDate(sDwgPropAry(17)), but this still is not valid because you need a valid
date format, and not a blank string.

From a "end-user" stand point, a check box will set date values to be
blank.

Does anyone know if we can access this check box member via the API to set
a blank date value? (or is there another method available?).

I forward a thanks!

-Kerwin

"non-working" code snippet:

For Each oStdDwgPropSet In oDwgPropSets

            For
Each oDwgProp In oStdDwgPropSet

                Select
Case oDwgProp.Name

                    Case
"Creation Time"

                        oDwgProp.Value
= sDwgPropAry(17)

                    Case
"Date Checked"

                        oDwgProp.Value
= sDwgPropAry(19)

                End
Select

            Next
oDwgProp
        Next
oStdDwgPropSet

0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks Brian!

That explains why I was seeing the date "1/1/1601" popping up in my textboxes (i.e. when user has dates turned off with the checkbox).

Everything now makes sense... glad that this method is available!

Thanks again.

-Kerwin
0 Likes
Message 4 of 5

Anonymous
Not applicable
Brian,

I ran into one additional problem...

After I set the date to #1/1/1601# the iProperties will be set with a "blank" checkbox. However, I have these properties displayed in a Title Block Def. as drawing properties, and the text 1/1/1601 is displayed.

If I go in from an end user standpoint and "check", then "uncheck" the checkbox for creation date, check date. The values will then appear blank on the title block.

"1/1/1601" will remain displayed in the title block even after I save, close, and re-open.

Any ideas on what causes this? Is there a method to refresh?

Thanks.

Kerwin
0 Likes
Message 5 of 5

Anonymous
Not applicable
To all developers:

This message that I posted has been logged by Autodesk as an error in the API... and a case has been filed to have it fixed.
0 Likes