4 Replies Latest reply on Sep 21, 2017 6:46 AM by John Stoltzfus

    Macro dimensions

    Shane Pickup

      Hi Everyone.

       

      I'm struggling learning vba so I take my hat off to you people who know your stuff and help people like me.

       

      Ive been trying to record a macro to create a basic cabinet door from scratch.  I plan to create a userform so the user can input sizes which then draws the cabinet door and depending on the size suspresses some features.  The macro seems to work ok until it gets to the third dimension on the second sketch (goes from one of the lines of a rectangle in a sketch to an edge of the top face of an extruded part which the sketch is on.

       

      The macro sketchs, dimensions and extrudes the outline of the door Ok.

      The macro then sketches and dimensions a shape (lock cutout) on the top face of the extruded part which I intend to extrude cut.  Before I extrude cut the sketch I wanted to add locating dimensions from the edges of the extruded part so I could move the feature depending on size of the door.

       

      As soon as the macro hits the first locating dimension it stops and errors.

       

      Is it because the dimension is to something that is not in the sketch or to two entities?

       

        Can anybody help me understand why this is happening and/or advise a solution.

       

      Regards

       

      Shane

        • Re: Macro dimensions
          John Alexander

          Hey Shane,

           

          Are you recording this as a VBA macro? Could you paste your code or attach the macro file?

           

          As soon as the macro hits the first locating dimension it stops and errors.

          What is the error message when your macro stops?

           

          Is it because the dimension is to something that is not in the sketch or to two entities?

          I don't have a whole lot of experience with DisplayDimensions or Dimensions in the Solidworks API. I'm starting to dive into those right now actually. From my limited experience with them, I've done several of the things that the documentation recommends not to do and I have not observed any exceptions or crashes.

          • Re: Macro dimensions
            Christian Chu

            It might be easier if you can use your macro (with userform) to get/retrieve parameters or variables (whatever you want to call) from the equation. and the sketch dimensions should be linked to equation variables. then you don't have to worry about the dimension or sketch names

            • Re: Macro dimensions
              Deepak Gupta

              Unless you share the macro and corresponding file, it would hard to debug.

               

              On other side, you may want to try/use the DriveWorksXpress (free add-in for design automation since 2008 with every seat of SOLDIWORKS). It would be fairly easy to use and not only model (part and assemblies) but you can also get the drawings made.

              • Re: Macro dimensions
                John Stoltzfus

                Like Deepak Gupta - mentioned to de-bug, the guys would need the macro and the file.  Another guy that uses user forms is JOHN GEORGE, he would be able to help out..