API my updates to props are not saved

Discussion in 'SolidWorks' started by John, Oct 18, 2003.

  1. John

    John Guest

    I have made a VBA routine that can set some custom properties on SW-files.

    My routine shows the value of "Title" - then sets Title to a new value.

    I would expect the date on the SW-file to change when I made updates - but
    that does not happen....despite the fact that I can extract the just changed
    value...

    So somehow I don't manage to make the changes "permanent" - when I open the
    SW-file in SW I am asked to save the changes... and if I reject I am back to
    the original SW-file.

    Do I need to "commit" the changes in order to make the updates permanent?
     
    John, Oct 18, 2003
    #1
  2. I am sure there is a better way, but what I did to remedy this is to save
    the document after making the changes. If you make the changes at the
    assembly level it changes the model in memory but doesn't change the one on
    the Hard Drive. I am sure there is a way to tell the up-level assembly that
    a component needs to be saved but I haven't looked into it much. Anyway Yes
    you have to "commit" isn't that what permanent is? =^)

    Corey Scheich
     
    Corey Scheich, Oct 20, 2003
    #2
  3. keep in mind the API does exactly the same as the UI (user interface):
    once you change properties (by hand) you have to save the document. Same
    with API.
    And when you have to click the green light for a rebuild, for example to
    propagate changes made in a part to the assemly, you must call the
    ModelDoc::Rebuild to do the same...
    The best way to start a VBA macro is always to record it while doing the job
    manually...
     
    Philippe Guglielmetti, Oct 20, 2003
    #3
  4. ModelDoc2::SetSaveFlag


     
    Sean Phillips, Oct 20, 2003
    #4
  5. The recorder is not the best way. if people are having problems
    writing Programs with solidworks API and VBA. Its because they dont
    know VBA. If you understand VBA. Then everything you need is in the
    solidworks API help file. learning Solidworks API and VBA at the same
    time is not the way to do it. Thats how i did it. You need a degree of
    seperation from what is VBA and what is Solidworks API. After learning
    VBA the solidworks API is just a tool you use in VBA. I would also say
    that VBA is a choped up version of VB6. Id learn VB6 and upgrade to
    ..net mabey 1/2 a year from now. I still have not upgraded.
     
    Sean Phillips, Oct 21, 2003
    #5
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.