Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Delete ImportedComponent from part environment

sneha.sadaphal
Advocate

Delete ImportedComponent from part environment

sneha.sadaphal
Advocate
Advocate

Hi,

I have inserted the step file as imported component in inventor part environment.

and also added one button to delete that imported component. 

but seems like the importedComponent.delete() is not implemented.

getting error for delete();

Is anyone have idea about this?

snehasadaphal_0-1691493588589.png

 

if (_document != null && _document.DocumentType == DocumentTypeEnum.kPartDocumentObject)
            {
                PartDocument _oPart = _document as PartDocument;
                var oPartCompdef = _oPart.ComponentDefinition;                
                ImportedComponents impComps = oPartCompdef.ReferenceComponents.ImportedComponents;
                foreach (ImportedComponent CompOcc in impComps)
                {                   
                  string fileUrn = CompOcc.Name.Replace(".stp","");
                   if (exchangeItem.ExchangeID.Contains(fileUrn))
                   {
                       CompOcc.Delete();
                   }
                }

            }

 

0 Likes
Reply
134 Views
0 Replies
Replies (0)