It is done in the part doc, but why does the error occur in the assembly doc?

It is done in the part doc, but why does the error occur in the assembly doc?

Anonymous
Not applicable
561 Views
6 Replies
Message 1 of 7

It is done in the part doc, but why does the error occur in the assembly doc?

Anonymous
Not applicable

Sub RemoveAllModelAnnotations()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As ComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
Do While oCompDef.ModelAnnotations.Count > 0
oCompDef.ModelAnnotations.Item(oCompDef.ModelAnnotations.Count).Delete
Loop
End Sub

0 Likes
562 Views
6 Replies
Replies (6)
Message 2 of 7

johnsonshiue
Community Manager
Community Manager

Hi! Inventor's 3D Annotation can be created in Part and Assembly. Is it possible there could be 3D Annotations at the assembly level? Could you share an example that exhibits the behavior?

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 7

Anonymous
Not applicable

ToForum.PNG

0 Likes
Message 4 of 7

sundars
Autodesk
Autodesk

Hi @Anonymous 

 

Thank you for reporting this issue. I have verified that this is a problem that the delete API for 3d annotations is not working in the assembly environment. Unfortunately, I am not seeing a workaround for the moment but if i find one i will update you.

 

I have created a defect for this and we will investigate this. You can refer to this ticket if you need more information: INVGEN-39350.

 

Thanks for reporting this. Good catch!

-shiva

 

Shiva Sundaram
Inventor Development
0 Likes
Message 5 of 7

Anonymous
Not applicable

20200408_101650.jpg

 Dim oCommandMgr As CommandManager
Set oCommandMgr = ThisApplication.CommandManager
Dim oControlDef As ControlDefinition
Set oControlDef = oCommandMgr.ControlDefinitions.Item("This")

Do you know the named internal name?

0 Likes
Message 6 of 7

sundars
Autodesk
Autodesk

Hi @Anonymous 

 

You could try "AppDeleteCmd".

ThisApplication.CommandManager.ControlDefinitions.Item("AppDeleteCmd").Execute

 

Thanks

-shiva

Shiva Sundaram
Inventor Development
0 Likes
Message 7 of 7

Anonymous
Not applicable

Thank you.