How to Delete feature below end of part in inventor using vb.net or VBA

How to Delete feature below end of part in inventor using vb.net or VBA

umesh.mhaskar
Contributor Contributor
992 Views
2 Replies
Message 1 of 3

How to Delete feature below end of part in inventor using vb.net or VBA

umesh.mhaskar
Contributor
Contributor

Hello,

           I want to Delete feature below end of part,

           any one can tell me how to do this using vb.net or VBA

 

Regards,

Umesh

0 Likes
993 Views
2 Replies
Replies (2)
Message 2 of 3

umesh.mhaskar
Contributor
Contributor

Try
Dim objpartdoc As PartDocument
objpartdoc = objapp.ActiveDocument

If objpartdoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then

Dim objPartCompDef As PartComponentDefinition
objPartCompDef = objpartdoc.ComponentDefinition
'Dim part = objPartCompDef.Occurrences.Item(1).Constraints.Item(1)

Dim objBrawserpanes As BrowserPanes
objBrawserpanes = objapp.ActiveDocument.BrowserPanes
Dim browserPan As Inventor.BrowserPane = (From _Pan As BrowserPane In objBrawserpanes Where _Pan.TreeBrowser Select _Pan).FirstOrDefault

Dim DoDelete As Boolean = False
Dim ObjCollection As ObjectCollection = objapp.TransientObjects.CreateObjectCollection()

For Each _node As BrowserNode In browserPan.TopNode.BrowserNodes
If DoDelete Then
Dim obj = _node.NativeObject
ObjCollection.Add(obj)
End If
Dim def = _node.BrowserNodeDefinition
Dim x = def.Label
If x.ToUpper().Contains("END OF PART") Then
DoDelete = True
End If
Next

objPartCompDef.DeleteObjects(ObjCollection)

Else
MessageBox.Show("Please Open Part Document...")
End If

Message 3 of 3

CAD_CAM_MAN
Advocate
Advocate

You may try using the command manager.

This worked for me...

 

'Set the end of part as needed...
'oPartDoc.ComponentDefinition.Features.Item(X).SetEndOfPart
'Where oPartDoc is your part document and X is the position
'you want to set the end of part.

Dim CDef As ControlDefinition
				CDef = InventorApp.CommandManager.ControlDefinitions.Item("PartDeleteBelowStopNodeCtxCmd")
				CDef.Execute()

 

 

0 Likes