Reply

All Pmi Delete?

Hi ~ Edge Developer
I am looking for code to delete all PMI elements.
How can I delete items of all dimensions with a single click?

6 REPLIES

Re: All Pmi Delete?

Hi,

 

Since you didn't specify part or assembly, i did for both. see below code,

 

Dim objApp As SolidEdgeFramework.Application
' Dim objDoc As SolidEdgeAssembly.AssemblyDocument
Dim objDoc As SolidEdgePart.PartDocument
Dim objdimepmi As SolidEdgeFrameworkSupport.PMI = Nothing
Dim objdimes As SolidEdgeFrameworkSupport.Dimensions
Dim objdime As SolidEdgeFrameworkSupport.Dimension
Dim objwindow As SolidEdgeFramework.Window
Dim view As SolidEdgeFramework.View


objApp = GetObject(, "SolidEdge.Application")

objDoc = objApp.ActiveDocument

objDoc.PMI_ByModelState(objdimepmi, SolidEdgePart.PMIModelStateConstants.seDesignModelState)

objdimes = objdimepmi.Dimensions
objwindow = objApp.ActiveWindow

view = objwindow.View

For i = objdimes.Count To 1 Step -1
objdime = objdimes.Item(i)

objdime.Delete()

view.Update()

Next

 

if you want to use with assembly, just change the document type.

 

 Dim objDoc As SolidEdgeAssembly.AssemblyDocument
'Dim objDoc As SolidEdgePart.PartDocument

 

This is what you are looking?

 

Thanks,

Bala.

Re: All Pmi Delete?

Thank you.
This code seems to be right.
We will inform you by comment after confirmation.

Re: All Pmi Delete?

Thank you very much.
This code is correct.

I will ask further questions.
To use it in parts and in assemblies ..
So I want to use it in any environment.

Can I not code assembly and part environments at the same time?

Re: All Pmi Delete?

Hi,

 

you can use "if esleif" staement or "case type" statment,

 

i used if statemet,

 

Dim objApp As SolidEdgeFramework.Application
Dim objassy As SolidEdgeAssembly.AssemblyDocument
Dim objsht As SolidEdgePart.SheetMetalDocument
Dim objpart As SolidEdgePart.PartDocument
Dim objdimepmi As SolidEdgeFrameworkSupport.PMI = Nothing
Dim objdimes As SolidEdgeFrameworkSupport.Dimensions
Dim objdime As SolidEdgeFrameworkSupport.Dimension
Dim objwindow As SolidEdgeFramework.Window
Dim view As SolidEdgeFramework.View


objApp = GetObject(, "SolidEdge.Application")

If objApp.ActiveDocumentType = DocumentTypeConstants.igAssemblyDocument Then
objassy = objApp.ActiveDocument

objassy.PMI_ByModelState(objdimepmi, SolidEdgePart.PMIModelStateConstants.seDesignModelState)
ElseIf objApp.ActiveDocumentType = DocumentTypeConstants.igPartDocument Then
objpart = objApp.ActiveDocument

objpart.PMI_ByModelState(objdimepmi, SolidEdgePart.PMIModelStateConstants.seDesignModelState)
ElseIf objApp.ActiveDocumentType = DocumentTypeConstants.igSheetMetalDocument Then
objsht = objApp.ActiveDocument

objsht.PMI_ByModelState(objdimepmi, SolidEdgePart.PMIModelStateConstants.seDesignModelState)
End If

objdimes = objdimepmi.Dimensions
' On Error Resume Next

objwindow = objApp.ActiveWindow

view = objwindow.View


For i = objdimes.Count To 1 Step -1

objdime = objdimes.Item(i)

objdime.Delete()

view.Update()

Next

 

Thanks,

Bala.

Re: All Pmi Delete?

Thank you so much.
You are my mentor.


I hope you will be good today. ^^

Re: All Pmi Delete?

[ Edited ]

Hi,

 

Thanks.

 

you too have a great day...

 

Thanks,

Bala.