Inventor 2018 - Problem with Collection / Reusing Selection Set

Inventor 2018 - Problem with Collection / Reusing Selection Set

MattH_Work
Collaborator Collaborator
872 Views
9 Replies
Message 1 of 10

Inventor 2018 - Problem with Collection / Reusing Selection Set

MattH_Work
Collaborator
Collaborator

I use the code below to build a collection

 

Public Sub Collection_Build()
Dim oSelectSet = oApp.ActiveDocument.SelectSet
     Dim i As Integer
     For i = 1 To oSelectSet.Count
          ColGeneral.Add(oSelectSet.Item(i))
     Next
End Sub

 

And the code below to 're-select' after processing the selected items (so that I can repeat if necessary)


Public Sub Collection_Rebuild()
     Dim i As Integer
     For i = 1 To ColGeneral.Count
          oApp.ActiveDocument.SelectSet.Select(ColGeneral.Item(i))
     Next
End Sub

 

I use the code within a drawing with Views, Text, Symbols etc. for move & rotate. The process works perfectly with Inventor 2015, 2016 & 2017.

However in 2018, views will not re-select if they have been rotated. Text & symbols work as expected but views only 're-select' if they have been moved. If a rotation occurs they need to be manually re-selected.

Is there a regression within 2018 that Autodesk can look into

 

Regards

 

MattH
   


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Accepted solutions (1)
873 Views
9 Replies
Replies (9)
Message 2 of 10

MattH_Work
Collaborator
Collaborator

Bump

 

Now using 2018.1.2 as still the same issue

 

Can Autodesk confirm if there is a bug / regression in 2018

 

Regards

 

MattH_Work


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Message 3 of 10

MechMachineMan
Advisor
Advisor

1. Try using .Clear before the re-select

 

2. See if .SelectMultiple has the same behavior.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 4 of 10

MattH_Work
Collaborator
Collaborator

Once I have run my code on the selected item(s) I already use oApp.ActiveDocument.SelectSet.Clear() before calling Collection_Rebuild()

 

If I move my item(s) the expected result occurs (item is deselected, my code reselects)

If I rotate my item(s), the item renames unselected

 

The same code (95%) is used for both move & rotate (Clear collection, rebuild collection, Move / Rotate,  oApp.ActiveDocument.SelectSet.Clear(), Collection_Rebuild())

 

Text & symbols rotate/move and reselct, Views will only 'reselect' themselves when using my move code, not my rotate code)

 

In 2016 & 2017 the exact same code works as expected for both move & rotate

 

Cheers

 

MattH_Work


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Message 5 of 10

MattH_Work
Collaborator
Collaborator
Accepted solution

This is is solved now that I have upgraded to 2018.2.3

 

Thanks Autodesk

 

Matt


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Message 6 of 10

MattH_Work
Collaborator
Collaborator

This has regressed AGAIN!

 

Now using 2019.1.2, dont know if issue occured during 2019.0 lifetime

 

MattH


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Message 7 of 10

AlexFielder
Advisor
Advisor

"Schrodinger's SelectSet" is what I've come to term this problem.

 

@MrSmithtastic & I have an addin we've been working on for some time:

 

https://github.com/AlexFielder/MyFirstInventorAddin

 

Which uses selectSet in the assembly environment to pull iProperties into a dockable window.

 

In 2018.2 it works as-as. All versions after that it doesn't work.

 

There's something about using the AssemblyDocument.SelectSet(1) which makes Inventor deselect the selectset if you query the contents or use them elsewhere.

 

 

Message 8 of 10

MrSmithtastic
Advocate
Advocate

Hey @MattH_Work can you confirm this isn't an issue in 2019?

 

I think it could be time for an update if that's the case!!

0 Likes
Message 9 of 10

MattH_Work
Collaborator
Collaborator

I can confirm, retaining the selection set DOES NOT WORK in 2019.1.2


MattH
Product Design Collection 2026
Vault Pro 2026
0 Likes
Message 10 of 10

MrSmithtastic
Advocate
Advocate

So in the same update patch for both Inventor 2019 and 2018 they've managed to break this!

 

Let's hope someone at Autodesk actually reads this and it gets patched back quickly. Until then mine and @AlexFielder's add-in is borderline useless!

 

I'm going to try and roll my update back if possible, definitely not cool!

0 Likes