Help Deleting Named Views and Purging Orphaned 3D Dims

Help Deleting Named Views and Purging Orphaned 3D Dims

Anonymous
Not applicable
461 Views
2 Replies
Message 1 of 3

Help Deleting Named Views and Purging Orphaned 3D Dims

Anonymous
Not applicable

I'm struggling with navigating the Inventor API Object Map, and would like some help.

I want to delete named features and views as well as orphaned 3D dimensions from a part file.

 

(This is would be running from an VB.Net executable not iLogic)

 

Deleting a feature is straight forward enough (see below), but I've failed to find the equivalent objects for part views and 3D dimensions. I assume this would be similar to a drawing file where you look for un-attached (anchored?) dimensions to delete, but need to get the collection first (obviously) to even try such a thing.

 

Dim thisDoc As Document
thisDoc = _invApp.ActiveDocument

Dim allFeatures As PartFeatures
allFeatures = thisDoc.ComponentDefinition.Features

allFeatures("Hole1").Delete()

0 Likes
Accepted solutions (1)
462 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

I'd like to know how to manually set the annotation scale of 3D dimensions using the API while I'm at it.

(I meant to include it in my original post which can't be edited at the moment, apparently.)

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

Very simple tasks made difficult because I couldn't rely on Visual Studio's intellisense for any hand holding.

I won't use these as-is of course, but I hope it'll help some poor dullard like myself.

 
Dim thisDoc As Document = _invApp.ActiveDocument
 
Delete a Feature:
        Dim allFeatures As PartFeatures = thisDoc.ComponentDefinition.Features
        Dim answer As String = InputBox("Feature Name to Delete", "Delete Feature")
        allFeatures(answer).Delete()
 
Delete a Work Plane:
        Dim allPlanes As WorkPlanes = thisDoc.ComponentDefinition.WorkPlanes
        Dim answer As String = InputBox("Work Plane Name to Delete", "Delete Work Plane")
        allPlanes(answer).Delete()
 
Delete an Annotation:
        Dim allDims As Object = thisDoc.ComponentDefinition.ModelAnnotations
        Dim answer As String = InputBox("Annotation to Delete", "Delete Annotation")
        allDims.Item(answer).Delete()
 
Delete a View Representation:
        Dim allViews As Object = thisDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations
        Dim answer As String = InputBox("View to Delete", "Delete View")
        allViews.Item(answer).Delete()
    End Sub
0 Likes