
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. 





|