iProperties, create a new property set |
Top Previous Next |
This function will create a new property set and optionally add in the first value of that property set:
void AddPropertySet(CComPtr<Document>& pInventorDoc, const CString& kcsNewPropSetName, const wchar_t* const pszFirstPropName /*= nullptr*/, const wchar_t* const pszFirstPropValue /*= nullptr*/) { CComPtr <PropertySets> pPropSets; pInventorDoc->get_PropertySets(&pPropSets);
CComPtr<PropertySet> pNewPropSet; CComVariant varInternalName; pPropSets->Add(CComBSTR(kcsNewPropSetName), varInternalName, &pNewPropSet);
if ((pszFirstPropName != nullptr) && (pszFirstPropValue != nullptr)) { CComPtr<Property> pProperty; CComVariant varPropVal(pszFirstPropValue); CComVariant varPropName(pszFirstPropName) ; CComVariant varPropId; pNewPropSet->Add(varPropVal, varPropName, varPropId, &pProperty); } }
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)