3 Replies Latest reply on Jul 20, 2016 9:49 AM by Ervin Podic

    View Macro

    Ervin Podic

      Hello there guys,

       

      Well for the start i want to say that i am total and whole greenhorn when it comes to the API's and VB (something small is left in head during high school).
      Well i got a job where employer uses SW2010 and he gave me task to check whether is possible to create macros for the following things:

       

       

      Macro 1: if it is possible with a macro to get the actual orientation of a part

      Macro 2: it is possible with a macro to set the orientation of a part

       

      What he wants to achieve is to turn part or assembly and afterwards to push a button and the part should turn to the most near predefined orientation.

      Well i know i maybe ask a little bit too much, but it is my first job and i would like to keep it because i am in no option of changing it (considering marriage).

       

      Thank you in advance people.

        • Re: View Macro
          John Alexander

          Just to clarify, are we talking about a Part Document (.sldprt) or a Part as a component in an Assembly Document (.sldasm)? It could also be that he wants to rotate the camera instead of the part?

           

          • If your boss wants to manipulate the orientation of a component in an assembly, yes there are ways of doing this very easily in the Solidworks API.

           

          • If your boss wants to manipulate the camera, he doesn't need a macro to do this. There is a hotkey to snap to the nearest standard view.

           

          • If your boss wants to manipulate the orientation of a part in a (.sldprt) document - I'm not aware that there is a quick way of doing so. Unless there is some clever trick to redefining the origin of a part, you would have to start at the top of the feature tree and redefine the sketch plane or whatever the root feature was and hope that everything below it was not making use of "global orientation" like horizontal, vertical, x-axis, y-axis, etc. sketch constraints.
            • Re: View Macro
              Ervin Podic

              Yes we talk about part and maybe in near future we will end up with assembly. I can ask him what he prefers (these 3 questions you asked) and then respond here on the forum to see the possible solution.

              • Re: View Macro
                Ervin Podic
                • If your boss wants to manipulate the orientation of a component in an assembly, yes there are ways of doing this very easily in the Solidworks API.

                 

                • If your boss wants to manipulate the orientation of a part in a (.sldprt) document - I'm not aware that there is a quick way of doing so. Unless there is some clever trick to redefining the origin of a part, you would have to start at the top of the feature tree and redefine the sketch plane or whatever the root feature was and hope that everything below it was not making use of "global orientation" like horizontal, vertical, x-axis, y-axis, etc. sketch constraints.

                 

                Probably First one would be the direction.