Possible operation on the parts, the assemblies or drawings.

This operation gives access the options standard “whole Value” of the documents. For more information on the use of these parameters, to see API help (API Help/Help).

 The use of this operation is reserved to the advanced users.

The choice is done among a list of option corresponding to the enumerator ''swUserPreferenceIntegerValue_e'':

 

The number of the value is to be chosen among a list. This number must be numeric. It can be entered with the keyboard or using the drop-down list:                 

Version 6 corresponds to swDxfFormat_R2010, (see API help swDxfFormat_e Enumeration)

 


Example : How to change the options of units of the document SOLIDWORKS on longueur=mm and mass=Kg?


- 1° One changes the units of the system on ''custom''.

       The option ''swUnitSystem“, in the list of the '' Options of the document (Integer)”, must be equal to the enumerator ''swUnitSystem_e'' which contains:

                                       swUnitSystem_CGS = 1

                                       swUnitSystem_MKS = 2

                                       swUnitSystem_IPS = 3

                                       swUnitSystem_Custom = 4

                                       swUnitSystem_MMGS = 5


- 2° One changes the units of length on ''mm''.

        The option ''swUnitsMassPropLength“, in the list of the '' Options of the document (Integer)”, must be equal to the enumerator ''swLengthUnit_e'' which contains:


swMM = 0

swCM = 1

swMETER = 2

swINCHES = 3

swFEET = 4

swFEETINCHES = 5

swANGSTROM = 6

swNANOMETER = 7

swMICRON = 8

swMIL = 9

swUIN = 10


- 3° One changes the units of mass on ''kg''.

       The option ''swUnitsMassPropMass“, in the list of the '' Options of the document (Integer)”, must be equal to the enumerator ''swUnitsMassPropMass_e'' which contains:


                                       swUnitsMassPropMass_Milligrams = 1

                                       swUnitsMassPropMass_Grams = 2       

                                       swUnitsMassPropMass_Kilograms = 3

                                       swUnitsMassPropMass_Pounds = 4


Notice 1:

To find these enumerators and their values, simplest is to make a recording of macro. Here for this same action one finds the values explained higher.


Sub main()

Set swap = Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SetUserPreferenceInteger (swUserPreferenceIntegerValue_e.swUnitSystem, 0, swUnitSystem_e.swUnitSystem_Custom)

boolstatus = Part.Extension.SetUserPreferenceInteger (swUserPreferenceIntegerValue_e.swUnitsMassPropLength, 0, swLengthUnit_e.swMM)

boolstatus = Part.Extension.SetUserPreferenceInteger (swUserPreferenceIntegerValue_e.swUnitsMassPropMass, 0, swUnitsMassPropMass_e.swUnitsMassPropMass_Grams)

End Sub


On the other hand, in the macro, we do not find the values (where the enumerators are stored). To find the value contained in an enumerator, it is enough to support on F2 in the editor the macro one and the explorer of object appears. By typing the name of the enumerator, for example “ swUnitsMassPropMass ”, in research, the variables and the values contained are visualized.

 

Notice 2:

By this method it is possible to control all the options of SOLIDWORKS

        Case with checking (example “Preparing/Always to display the text with the same size”)

        Integer (change example of unit like above)

        Number with comma (example “Annotation/Length of the line of fastener”)

        Text (example “Annotation/References/Next label”)


Notice 3:

Certain options are related the ones to the others, as in the example above.

If one had not regulated the units of the system on ''custom'', the change of unit of mass and length would have been without effect.


Notice 4:

This only allows the adjustment of the options of the document (tab “Properties of the document”).

The options of the system are not concerned with a batch treatment.