`eNotInGroup` exception when reading PropertySet values in multi-doc Civil3D sessions

`eNotInGroup` exception when reading PropertySet values in multi-doc Civil3D sessions

Wolfgang.B.Weh
Enthusiast Enthusiast
311 Views
2 Replies
Message 1 of 3

`eNotInGroup` exception when reading PropertySet values in multi-doc Civil3D sessions

Wolfgang.B.Weh
Enthusiast
Enthusiast

Environment

- Civil3D Versions: 2024 & 2026 (side-by-side)

- API: C# .NET (AEC Property Data)

- Property Type: Calculated / Formula Properties


Problem
I am encountering a persistent `eNotInGroup` exception when calling `propertySet.GetAt(propertyId)` to retrieve the value of a property where the names (PropertySet and Property) are identical across drawings.  

The exception occurs during a single Civil3D session when a drawing is opened after closing a preceding one, when the `propertyId` of the property in the current drawing is numerically higher than the `propertyId`  used in the previous drawing.

Observations
The code works perfectly for the first drawing opened.
If a subsequent drawing has a lower numerical `propertyId` for the property, it succeeds.
If a subsequent drawing has a higher numerical `propertyId` for the property, it throws `eNotInGroup`.

What I Have Tried (No Success)

- Iterate through `propertySet.PropertySetData`, check name and ID.

- Toggling SDI/MDI
- Toggling AECPSDAUTOATTACH
- Calling `propertySet.Synchronize()` before trying to read the value
- Added extensive `using` statements to ensure immediate object disposal

Questions
What else to try?
Any idea how to solve this?

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

Wolfgang.B.Weh
Enthusiast
Enthusiast

I was executing the code async from a modeless window, using...

Task.Run(() => ...


Use this instead:

AcCoreApp.DocumentManager.ExecuteInCommandContextAsync(...

 

0 Likes
Message 3 of 3

essam-salah
Advisor
Advisor

@Wolfgang.B.Weh wrote:

...
Problem
I am encountering a persistent `eNotInGroup` exception when calling `propertySet.GetAt(propertyId)`
...
Questions
What else to try?
Any idea how to solve this?


i alway call propertySet.PropertyNameToId(propName) before propertySet.GetAt(propertyId) in order to validate the name and the id in one call if it gets the id right i go to propertySet.GetAt(propertyId) if propertySet.PropertyNameToId(propName) failed i'll log/raise/handle the issue and continue

0 Likes