Thedefault option when working within assemblies. Opens the assembly and all of the associated file information. For example, when opening an assembly, all of the associated parts feature history is loaded into memory.
Opens the assembly, but none of the associated file information apart from the primary planes and the origin. Restricts the files from being edited. An image of a feather appears next to the associated file in the FeatureManager Design Tree.
Performs the same process as the Lightweight mode option above, however, it involves a few more options that can be altered as seen in Image 2. Each option restricts particular processes and features to aid performance. These options can be accessed via: Tools > Options > Assemblies.
Another technique you can use to improve navigational performance is to create a configuration within the assembly, suppressing some unnecessary associated parts and subassemblies. For example, many configurations may be needed for a different combination of the components within the main assembly. These can then be loaded upon the file opening if chosen on the open dialog box as seen below.
A SpeedPak configuration reduces the file size by limiting the file to specific faces or bodies. These faces are required for mate referencing only. You can either create a SpeedPak at top level or within the subassembly, each providing you with different options as follows:
The SpeedPak configuration at subassembly level can be created in the ConfigurationManager via the right mouse button (RMB) as seen in Image 6. The aim is to remove all but the information required (faces, associated mates, etc) to maintain the references at the top level. This then becomes a derived configuration which has to be activated at top level.
It is not always possible to have the foresight in terms of how your assembly will finally be constructed. Sometimes it may be necessary to build up your assembly using all of the relevant parts, this however can make it top heavy and result in poor performance. It is always best to construct your assemblies with as many subassemblies as possible, which can either be done by inserting them individually (as normal), or at assembly level.
One of the fastest ways to go about this is to go Tools > Options > Performance. Here, there are a number of options that you can adjust to your liking, but for an immediate impact on performance, you can turn off options for both retaining high quality transparencies and reducing the level of detail used for curvature generation.
In Lightweight mode, which can be chosen from the Mode drop-down menu when opening an assembly in the Open dialog box, users still have access to many of the normal assembly commands. However, each component is loaded with the least amount of data, as symbolized in the Feature Tree with a feather.
While there are other options in the Mode drop-down menu when opening an assembly in the Open dialog box, including Large Assembly Mode and Large Design Review, Lightweight mode retains the greatest amount of functionality while reducing the amount of system resources required.
When working with top-level assemblies, oftentimes all that is needed are simplified representations of subassemblies such as specific faces or bodies for mating rather than entire memory-taxing subassembly structures.
Thankfully, SpeedPak lets users create simplified configurations of an assembly without losing references. Not only does this significantly improve performance while working in the assembly and its drawing, but it can also streamline the file-sharing process by enabling teams to send the least amount of necessary reference data while working within larger projects that have many subassemblies.
While Task Scheduler does have its limitations, it is a surprisingly powerful tool for automating repetitive resource-intensive tasks such as rebuilding large assemblies or converting CAD data to be more usable in your design system. Additionally, Task Scheduler can also be used to perform a specific task repeatedly on a daily, weekly or monthly basis if you have regularly occurring tasks.
For simple design reviews, opening up a fully functional assembly model is oftentimes unnecessary and can slow down communication due to system crashes or memory lags. Thankfully, options exist for both performing a design review within the softwareas well as sharing an assembly witha non-SOLIDWORKS user.
For quickly sharing an assembly for a design review directly within the software, enabling Large Design Review mode at the Open dialog box when opening an assembly enables users to quickly open, navigate, measure, comment, section, save edit notes for later and even selectively open and edit a part or subassembly while reviewing, among other functionalities. While working in Large Design Review mode can be extremely beneficial when presenting to others, it can also be an optimal way to work when reviewing your own work and making notes for edits that can be done at a later time or automated through Task Scheduler during off-peak hours.
Of course, every situation is different based on varying hardware setups and assembly file complexities, but familiarizing yourself with the above workflows can save a lot of time and headaches down the road.
The object also has loads of properties and methods. You can find a list of properties and methods when you open the documentation for an interface, like ISldWorks, and at the bottom, click ISldWorks members.
A property is something that the object has, it does not have to be calculated. A property has a value that you can get and often you can also set it. You can find it all in the documentation:
A method (often called a function) can have parameters, also called arguments (technically those are two different things, I know). When you call a method, you need to pass along those arguments. ActivateDoc3 has four parameters:
This errors variable is an output parameter (ByRef in VBA, out in C#), which means the method can change this value. It lets you return multiple variables from a method. You can also use out variables in your own code, although it is generally frowned upon.
You can access the current model via the swApp.ActiveDoc property (which is in the list of accessors for IModelDoc2) and once you have the model object, you can determine its type via the ModelDoc2.GetType method.
Once you have cast a ModelDoc2 to a part, assembly or drawing, you can access all properties and methods that are available for that specific model type. You can get all components from an AssemblyDoc object, for example.
Parts are the building blocks of any design. You use them to create geometry and volumes, whereas assemblies only use existing geometry (or subtract volume with assembly-level cuts). Parts consist of bodies and each body can have a material.
It is easier to use GetMaterialPropertyName2 to get the name of the material and the name of the database the material belongs to. To set the material, call SetMaterialPropertyName2. To remove the material, pass an empty string for the material name.
If a part is made from sheet metal, it has at least two configurations, a folded state and a flattened state. Each sheet metal body has its own flat pattern configuration. The flattened state really is a configuration with a few extra unsuppressed Flatten features, so be careful not to mess with these features.
Users can create sub-weldments to group bodies that belong together, for example because they are assembled in a single step. Sub-weldments also appear as a folder in the cut list, but they are a pain to work with in the API.
To create a hole or a cut-extrude, you first have to create a temporary body, then subtract that body from the main body. These operations are called boolean operations. The SOLIDWORKS developers also use these methods above to create geometry.
Every component has an underlying ModelDoc2 component, which can be an AssemblyDoc or PartDoc object. You get it by calling the GetModelDoc2 method. But be aware, this method can also return null if the model is not fully loaded.
How can that be, you ask? Well, you may know that you can load an assembly faster by loading it in Large Design Review mode or Lightweight mode. Large Design Review only loads the assembly file itself, no references, while Lightweight only loads about half of all data from the underlying parts and subassemblies. Resolved mode loads everything. To learn more about the underlying technology for these open modes, check out my ebook Secrets to SOLIDWORKS performance.
I found a dozen hints that drawings are secretly assemblies. Think of it, they contain multiple copies of existing geometry. You can create cuts in the form of section views and you can still rotate the views in 3D. Just like assemblies. The sheet is just another assembly component.
Because sheets can also contain notes and blocks, just like views, the first view on the sheet is actually the sheet. When you call IView.GetNextView, the next one is a real view (or null if there are no views).
To set the sheet format on a new, blank sheet, call SetProperties2, then call SetTemplateName, in that order. Annoyingly, even the SOLIDWORKS developers could not agree on what to call a template and what to call a sheet format.
To change the sheet format of an existing sheet, call IDrawingDoc.SetupSheet6. It needs way too many arguments, but you can get most of them from the current sheet. You can usually leave PropertyViewName empty, but make sure to set RemoveModifiedNotes to true to delete the old sheet format. The zones and zone margins are hardly used, so I use default values for a 55 grid and 10mm margins.
Each view (and the sheet as a view) has its own sketch that you can get via GetSketch. If you want to add notes to this view and you want them to move with the view, you need to add them to this sketch.
A bill of materials needs to be attached to a view and you call InsertBomTable4 to add one. But to get an existing BOM, you get the first sheet as a view via GetFirstView, then get the tables attached to that view via GetTableAnnotations. That might be because a Bill of Materials is not under a sheet or view in the feature tree, it is on the same level as sheets:
3a8082e126