API: Add a Component And Smart Mate It

Document created by Michael Kozikowski Employee on Sep 6, 2011Last modified by Michael Kozikowski Employee on Jan 2, 2013
Version 6Show Document
  • View in full screen mode

This is a VBA macro example to demonstrate that, beginning with SolidWorks 2012, a component can be added to an assembly which results in a smart mate. (Also called implicit, inference or auto mating). This means that an explicit IAssemblyDoc::AddMate3() does not have to be done, after adding a component. The component has to have a mate reference for this smart mate to work, and allows a mate to occur just like mouse clicking in the SolidWorks UI when the Insert Components Property Manager Page is open. (UI Insert\Component\Existing Part/Assembly). It results in one added component only per method call. The example uses the IAssemblyDoc::AddSmartComponent() method to accomplish this. Note that you do not have to use a smart component to create smart mates, just a component that has a mate reference. The example macro requires that the SolidWorks shipped sample assembly, .\samples\tutorial\stepped_shaft.sldasm be open when it is run.



- Subscription Services required for full access.

- Looking for more API Examples?



Copyright © 2011 Dassault Systèmes SolidWorks Corp. All rights reserved.
Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.