0 Replies Latest reply on Aug 8, 2013 5:26 AM by Mat Administrator

    CustomPropmgr .get2 works, .get4 not?

    Mat Administrator

      Hi there,

       

      currently i'm trying to develop a macro for setting some customprops in the CutListFolder.

       

      Until now my macros works, except one thing. I can't get CustomPropetertyManager.Get4 to work.

       

      I'll tried the obsolete function Get2 and it works, unfortunatelly not like expectet because it doesn't get the right evaluated value sometimes.

       

      How can i query a property from a CutListFolder with Get4? I hope someone can help me to find the right way

       

      Here is a Codesnippet that demonstrates my Problem.

       

      Option Explicit
      
      Sub main()
         
          Dim swApp As SldWorks.SldWorks
          Set swApp = Application.SldWorks
          Dim doc As SldWorks.ModelDoc2
          Set doc = swApp.ActiveDoc
          Dim f As Feature
          Set f = doc.FirstFeature
              Do While Not f Is Nothing
              If f.GetTypeName = "CutListFolder" Then
              Dim value1 As String
              Dim valueout1 As String
              Dim value2 As String
              Dim valueout2 As String
              Dim vPropNames As Variant
              Dim vPropTypes As Variant
              Dim vPropValues As Variant
              Dim value As Boolean
              
              f.CustomPropertyManager.GetAll vPropNames, vPropTypes, vPropValues
              
              Call f.CustomPropertyManager.Get2("WINKEL1", value1, valueout1)
              Debug.Print "Output from Get2: "; value1 + "; " + valueout1
              
              value = f.CustomPropertyManager.Get4("WINKEL1", False, value2, valueout2)
              Debug.Print "Output from Get4: "; value2 + "; " + valueout2
          
              Dim i As Integer
              For i = 0 To UBound(vPropNames)
                  Debug.Print "1 :" & vPropNames(i)
                  'Debug.Print "2 :" & vPropTypes(i)
                  Debug.Print "3 :" & vPropValues(i)
              Next
              End If
              Set f = f.GetNextFeature
          Loop
          
      End Sub
      

       

      Debug Output:

       

      Output from Get2: "ANGLE1@@@Zuschnittslistenelement1@MAT-00007811.SLDPRT"; 45.00

      Output from Get4: ;

       

      Output from Get2: "ANGLE1@@@Zuschnittslistenelement2@MAT-00007811.SLDPRT"; 45.00

      Output from Get4: ;

       

      Output from Get2: "ANGLE1@@@Zuschnittslistenelement3@MAT-00007811.SLDPRT"; 45.00 (<-- this should be 30.00 and i can't figure out why, but at first i should get this obsolete function out of the macro..)

      Output from Get4: ;