4 Replies Latest reply on Nov 28, 2012 12:39 PM by Mohammad Shaheer Zubairi

    Adding equations using API in SolidWorks

    Mohammad Shaheer Zubairi

      Hi everyone,


      I've been trying to add equations using API in SW. Long story short, if





      exp as String = """""" & a & """" & """=""" & """" & b & """"""


      swEquationMgr.Add -1, """" & exp & """"

      boolstatus = Part.EditRebuild3()


      ?exp in immediate window is = """D3@Sketch2@Block.Part""=""D1@Sketch1@Shaft.Part"""

      Whenever I rebuild the model, nothing happens.


      However, if I use

      swEquationMgr.Add -1, """D3@Sketch2@Block.Part""=""D1@Sketch1@Shaft.Part"""

      boolstatus = Part.EditRebuild3()


      everything works fine; the relationship is successfully added to the model and it also appears under the equations tool. I'm very confused about this issue. I've spent a lot of time, but no success in the end. Can anyone guide me where I'm going wrong. Any help would be much appreciated.


      Many thanks for your time and efforts.