Cai Industries

I can't update Custom properties with Document manager API

Discussion created by Cai Industries on Sep 12, 2019
Latest reply on Sep 12, 2019 by Josh Brady
  • I can't make persistent the new value of "alfa":
  • Dim DM_FACT As SwDMClassFactory = Nothing
    Dim DMAPP As ISwDMApplication = Nothing
    Dim DMDOC19 As ISwDMDocument19 = Nothing
    Dim DM_KEY As String = "..."

    DM_FACT = TryCast(Activator.CreateInstance(Type.GetTypeFromProgID("SwDocumentMgr.SwDMClassFactory")), SwDMClassFactory)
    DMAPP = DM_FACT.GetApplication(DM_KEY)
    Dim full_path_assy_comp As String = ".....\CURVE.SLDPRT"
    DMDOC19 = CType(DMAPP.GetDocument(full_path_assy_comp, SwDmDocumentType.swDmDocumentPart, True, Nothing), ISwDMDocument19)

    Dim cfMgr As ISwDMConfigurationMgr2 = DMDOC19.ConfigurationManager
    Dim conf As ISwDMConfiguration16 = cfMgr.GetConfigurationByName("DEFAULT")
    Dim names As String() = CType(conf.GetCustomPropertyNames(), String())
    For Each prop As String In names
    Dim val As String = conf.GetCustomProperty(prop, SwDmCustomInfoType.swDmCustomInfoNumber)
    MsgBox(prop + "=" + val)
    [It show me actual value of 90.00 for alfa ]
    Next

    conf.SetCustomProperty("alfa", "57.00")
    DMDOC19.Save()
    For Each prop As String In names
    Dim val As String = conf.GetCustomProperty(prop, SwDmCustomInfoType.swDmCustomInfoNumber)
    MsgBox(prop + "=" + val)
    [It show the new value of 57.00 ]
    Next
    DMDOC19.CloseDoc()

    [When i openthe part in SW .. alfa is still 90 ]

Outcomes