LF VB help - Deleting custom properties

Discussion in 'SolidWorks' started by Ronni, Jan 30, 2008.

  1. Ronni

    Ronni Guest

    Hey - I am trying to make a macro that can delete all my custum
    properties (configuration specifik props) except those in the Default
    configuration.

    I am trying to do it manually by writing in all the names of the
    properties, but that aint really a good solution (I have around 30-50
    different named properties and not all are present on all parts)

    Also I am trying to just take them from i=1 (instead of i=0, then
    presuming that default always gets the list value 0)

    So I need some input to do this in a better way, and not to make
    asumptions like the one above.
    Alternate I was thinking about dropping the default settings, deleting
    everything and then copying it back onto the Default config.

    So it looks similar to this (just with many more properties):

    Dim swApp As SldWorks.SldWorks
    Dim swmodel As SldWorks.ModelDoc2
    Dim reval() As String
    Dim i As Integer

    Set swApp = Application.SldWorks
    Set swmodel = swApp.ActiveDoc

    reval = swmodel.GetConfigurationNames()
    For i = 1 To UBound(reval)
    swmodel.DeleteCustomInfo2 reval(i), "Modelnr"
    swmodel.DeleteCustomInfo2 reval(i), "Betegnelse"
    swmodel.DeleteCustomInfo2 reval(i), "Material"
    swmodel.DeleteCustomInfo2 reval(i), "sMaterial"
    swmodel.DeleteCustomInfo2 reval(i), "Mass"
    swmodel.DeleteCustomInfo2 reval(i), "Designer"
    swmodel.DeleteCustomInfo2 reval(i), "Edition"
    swmodel.DeleteCustomInfo2 reval(i), "Date"
    Next
     
    Ronni, Jan 30, 2008
    #1
  2. Ronni

    That70sTick Guest

    That70sTick, Jan 30, 2008
    #2
  3. Ronni

    Ronni Guest

    Thanks for inspiration, looks good and seems to work well.
     
    Ronni, Jan 31, 2008
    #3
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.