Global Websites 3D Mechanical Software, 3D CAD Software for AutoCAD users  Contact Us 3D Mechanical Software, 3D CAD Software for AutoCAD users  Login 
      Advanced Search
1-800-693-9000 (US and Canada)
+1-978-371-5011 (Outside the US and Canada)
Have a Salesperson Call Me (US/Canada)
 

Services


Services




SolidWorks Tech Alerts
TT_SWAPIVirtualComponents
SolidWorks Technical Tip

SolidWorks API and Virtual Components

Solution ID:

S-020221

Applies to: SolidWorks API
Version: 1.0

Category:

API, Components, Assemblies, Features

Created:

02-19-2008

Last revised:

02-19-2008

In SolidWorks 2008 SP0 and later, by default newly inserted components are virtual components that exist in the assembly file in which they are created.

Thus, you cannot use the SldWorks event PromptForFileNameNotify and the method SldWorks::SetPromptFilename to set a filename for the newly inserted component because this event is no longer fired in this scenario. Instead, you should use the AssemblyDoc event AddItemNotify and check for swNotifyEntityType_e::swNotifyComponent.

You can get the inserted item as a:

  • Feature using AssemblyDoc::FeatureByName.
  • Component2 using Feature::GetSpecificFeature2.

You can determine whether the item is a virtual component using Component2::IsVirtual, and, if it is, you can change the name of that virtual component using Feature::Name.

 

©2008 Dassault Systèmes SolidWorks Corp.

Terms of Use  Privacy Policy  Piracy Prevention  License Agreement  SolidWorks RSS