Date problem, please help

Discussion in 'SolidWorks' started by SW Monkey, Jun 21, 2005.

  1. SW Monkey

    SW Monkey Guest

    We recently changed out titleblocks, and we also changed the date
    format for the "Date" field.

    Our old format was , Month/Day/Year (06/21/05)

    Our new format is Year-Month-Day (2005-06-21)

    I have a custom property called "Date", and its in Date format.

    I know that this field is determined by the Windows Date/Time system
    settings on your computer, but thats were my problme arises.

    If I change my system setting to 2005-06-21, the field in the
    titleblock looks fine. If I open that drawing on someone elses
    computer though, the date displays in whatever format their system
    setting is set at.

    Why does this happen? It makes sense for when you first enter the
    date, but why does the date field change depending on the computer?

    Is there a way around this? I could change the custom property format
    to Text, but then I wouldnt be able to use the macro I have that inputs
    this date automatically with a touch of a button.

    Anyone ever run into this issue? Any ideas how I can resolve it?
     
    SW Monkey, Jun 21, 2005
    #1
  2. SW Monkey

    kmaren24 Guest

    It sounds as if you know the answer already. You have to change every
    computer in the Windows setting to the Windows Date/Time to show
    2005-06-21. We use the same date codeing and we have all (2) of our
    CAD stations set to have the 2005-06-21 date code and it works fine.

    KM
     
    kmaren24, Jun 21, 2005
    #2
  3. SW Monkey

    SW Monkey Guest

    Well, that only works for the computers that CREATE the drawing. If
    you save the drawing, and open it on another computer that doesnt have
    that date format setting in the system settings, the date WILL change
    from how you had it on your computer.

    Why does SolidWorks do this? I can understand this when you first
    enter the date, but this format shouldnt change by just opening the
    document.

    The problem is, we have 20+ people who view SolidWorks drawings. Only
    about 8 actually create them.

    Also, if I send it out for a quote, it wouldnt make sense to have to
    tell them to change their Windows settings so the date will display
    correctly.

    Am I the only one that has this problem ? :)
     
    SW Monkey, Jun 21, 2005
    #3
  4. The action makes sense to me in that the user sees a date formatted per his
    choice. I don't know exactly what your macro does to stuff in the date, but
    how about changing it to grab today's date, convert it to text, put it in
    the desired order, and then stuff that value into the note.

    WT
     
    Wayne Tiffany, Jun 21, 2005
    #4
  5. SW Monkey

    kmaren24 Guest

    That is starting to sound a little more complicated. What about
    setting the "viewers" to read only access to the drives of your
    drawings. We changed to the long date code for manufacturers overseas.
    We did make sure their date code was the same as ours. Anyone else we
    send prints to either gets it via Edrawings or PDF so it makes it
    easier for us.

    KM
     
    kmaren24, Jun 21, 2005
    #5
  6. SW Monkey

    SW Monkey Guest

    That sounds like it would work. If its in text format, than the
    windows setting wouldnt matter.

    Do you have such a macro to do this? Im not sure how to get a macro to
    convert the date to text, and put it in the desired order :)
     
    SW Monkey, Jun 21, 2005
    #6
  7. In your macro, set a variable for the date to the type of String, such as:
    Dim strDate as String

    Then down in your code do something like:
    strDate = Date

    This will assign the current date value to the variable as a string, which
    you can then assign to your date field as you currently are. If you still
    need help, post your macro code where you are currently assigning the
    current date.

    WT
     
    Wayne Tiffany, Jun 21, 2005
    #7
  8. Oops, I forgot to rearrange it. Use the substring function to grab a piece
    of it and then paste it back together.

    WT
     
    Wayne Tiffany, Jun 21, 2005
    #8
  9. SW Monkey

    SW Monkey Guest

    Thanks WT,

    Here is my code. Somehow, I think your first post didnt go thru.

    Dim swApp As Object
    Dim DrawingDoc As Object
    Sub main()
    Set swApp = CreateObject("SldWorks.Application")
    Set DrawingDoc = swApp.ActiveDoc
    retval = DrawingDoc.DeleteCustomInfo("DATE")
    retval = DrawingDoc.AddCustomInfo("DATE", "Date", Str(Date))
    DrawingDoc.EditRebuild
    End Sub
     
    SW Monkey, Jun 21, 2005
    #9
  10. Sorry for the delay - quite busy.

    It looks like it should work with a couple things. Change the AddCustomInfo
    line to:

    retval = DrawingDoc.AddCustomInfo("DATE", "Text", Str(Date))

    This sets the type of the property to text, rather than a date property.
    The date string that you paste back in then will be in the format of your
    current Windows setting, which should be as you want it, and the property in
    the file should not change since it's text, and not a date.

    Now, the other issue. The DeleteCustomInfo function is case sensitive, as
    in if the file has a property called "Date" then the delete will fail, and
    you won't be able to write the new one in. So, if your drawings are all the
    same - ok. If not, you will have to either delete it manually, or run a
    routine that looks through all the properties to see if one exists that is
    the same as "DATE" only with different case.

    WT
     
    Wayne Tiffany, Jun 21, 2005
    #10
  11. SW Monkey

    SW Monkey Guest

    That works. Thanks. I would be nice if the macro could change the
    date to the proper format, rather than getting everyone to change their
    windows date/time setting. I noticed the date format also changes in a
    number of other programs, which could give us a headache later on.

    Do know of a way to have a custom property in a particular cell of the
    new revision table added in SW 2004? If I edit text in the cell, and
    link to a custom property, the custom property doesnt show up, only
    $PRP:"Released_Date"

    Reason I need this in a cell, is we start off at Rev 0. When adding a
    Rev to the rev table, it starts at Rev 1. So we had to manually add a
    row, so we could have a Rev 0.
     
    SW Monkey, Jun 21, 2005
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.