2 Replies Latest reply on Nov 24, 2015 12:23 PM by Rajat Jain

    ModelDocExtension

    Nirantar Vidyarthee

      When the ModelDoc2 object already exists, why was it necessary to create additional object ModelDocExtension?

      Can we logically differentiate / catagorize the functions handled by the two?

      In other words, how can I guess that certain functionality must belong to ModelDocExtension & not ModelDoc2?

        • Re: ModelDocExtension
          John Alexander

          This doesn't answer your broader question but it might be helpful. You don't normally need to store a reference to the ModelDocExtension. You can usually access it with:

           

          swModelDoc.ModelDocExtension.MethodYouWantToUse

           

          where swModelDoc is a ModelDoc2.

          • Re: ModelDocExtension
            Rajat Jain

            Hi..

             

            Welcome to SolidWorks API Nirantar Vidyarthee!!!

             

            Let me try and explain it.

             

            Modeldoc is a class which contains all information about a Model. It has all the properties of a SolidWorks Model. A ModelDocExtension class is created to separate out some of the operations which are performed on ModelDoc not by ModelDoc itself. ModelDoc updates its state when these operations are performed on it and ModelDocExtension always uses ModelDoc parameters to perform these operations.

             

            For e.g. say I have a human class. A human class has hair style which is its own property. This property can be modified but it is not modified by human itself. Since its not done by it itself, we call it a HumanExtension class which does this operation on human. Kindly note that the operation is performed on Human and state of the Human class property(HairStyle) is updated by HumanExtension class but this operation is done by HumanExtension and not by Human.

             

            SolidWorks has recently made some structural changes in the API to ensure that the flow understanding is simplified.

             

            Please note that this explanation is strictly my own understanding and the actual reason for the differentiation might be different. It would be great to hear from experts though.

             

            Hope it helps!!!

             

            Rajat Jain