2 Replies Latest reply on Mar 26, 2012 4:57 PM by Filipe Venceslau

    Displaying (variable) property text in dimension.

    Ales Kozelsky

      Hello

       

      I would like to ask, if there is any way to ,,attach" a property or simply any text (which is controlled from design table) to dimension.

      Here are two examples, between I would like to vary the text using excel table :

       

      1)

       

      I<-------- 100 (length by knifing)---------->I

      I                                                            I

      I                                                            I

       

       

      2)

       

      I<-------- 100 (length by laser cutting)-->I

      I                                                           I

      I                                                           I

       

       

      Is there any simple way ?

       

      Thank you in advance for any tips.

       

       

      Ales

        • Re: Displaying (variable) property text in dimension.
          Marcello Jacobs

          Currently I have not found a way to do this, but I have created an "Enhancement Request" asking for this capability.

          • Re: Displaying (variable) property text in dimension.
            Filipe Venceslau

            Hi Ales, I don't know of a simple way of doing this. Being that said, I don't have advanced experience with design tables, so there might be something in there that I am unaware of.

             

            There is however a COMPLICATED way of doing it!

             

            Dynamic_property.png

             

            This works simply because of the ability to run VBA code within a custom property linked to an equation.

            This is a simple concept, yet pretty complicated to get working right, and is prone to causing your solidworks to crash.

             

            The main component is the custom property CodeDummy, which contains the following lines fo code:

             

            1
            Dim cpmgr As CustomPropertyManager
            Set cpmgr = part.Extension.CustomPropertyManager("")
            
            Dim strLength, strLaser, strKnife, strCutType As String
            strLength = cpmgr.Get("Length")
            strLaser = cpmgr.Get("LaserCut")
            strKnife = cpmgr.Get("KnifeCut")
            strCutType = cpmgr.Get("CutType")
            
            Select Case LCase(strCutType)
                Case "laser"
                    Call cpmgr.Set("CutText", strLength & strLaser)
                Case "knife"
                    Call cpmgr.Set("CutText", strLength & strKnife)
                Case Else
                    Call cpmgr.Set("CutText", strLength & " INVALID CUT TYPE (Laser OR Knife)")
            End Select
            
            

             

            This code looks at the Custom property CutType and if it is set to Laser for example, it will use the LaserCut as the suffix on the CutText custom property. The same goes for if the value read equals Knife. The final custom property is the CutText and it is built using the Length property together with the chosen suffix.

             

            Check out the attached part for more details...

             

            Sometimes complicated is fun...but most of the times it means headaches, so this might not be the right option for you. I just wanted to make you aware of it!

             

            Hope this helps,

             

            Filipe