Hi,
I am trying to return the value of a text element that is a Annotation Cell but don't seem to be able to include it in my filter?
There doesn't seem to be a msdelementtype for it?
Dim myEnum As ElementEnumerator Dim myFilter As New ElementScanCriteria myFilter.ExcludeAllTypes myFilter.IncludeType msdElementTypeTextNode myFilter.IncludeType msdElementTypeText myFilter.ExcludeAllLevels myFilter.IncludeLevel att.Levels("D-ANNO-Chainage Labels Minor") myFilter.IncludeLevel att.Levels("D-ANNO-Chainage Labels Major") myFilter.IncludeLevel ActiveModelReference.Levels("D-ANNO-Chainage Labels Minor") myFilter.IncludeLevel ActiveModelReference.Levels("D-ANNO-Chainage Labels Major")
Les Leayr said:I am trying to return the value of a text element that is a Annotation Cell
As others have commented, you should scan for an annotation cell element. Once found, search its sub-elements for text elements.
Easier said than done! Unfortunately there is no AnnotationCell element, nor does a CellElement have an IsAnnotation property. VBA is not alone — other APIs lack proper support for annotation cells.
CellElement
Les Leayr said:a text element that is a Annotation Cell
The text element is a component, or sub-element, of the cell. If you can retrieve a CellElement, use its GetSubElements method.
GetSubElements
Regards, Jon Summers LA Solutions
Jon Summers said:VBA is not alone — other APIs lack proper support for annotation cells.
It's not true in my opinion, there is ICellQuery::IsAnnotation in C++, the same method exists also in NET API.
Jon Summers said:Unfortunately there is no AnnotationCell element, nor does a CellElement have an IsAnnotation property.
But there is PropertyHandler, that can be used to obtain information from IsAnnotation. I did not test such code, but the property exists.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I guess again I didn't fully explain what I am trying to achieve and I do apologise.
So let's say I convert the Annotation Cells to Text Node Elements, I am trying to scan through an attachment that has a clip boundary controlled by a saved view applied and return the values of the text node elements that are visible in the attachment.
Sorry, just realised that it is a nested attachment :(
Hi Les,
Les Leayr said:and I do apologise.
No problem, the common aim is to make the situation clear ;-)
Les Leayr said:So let's say I convert the Annotation Cells to Text Node Elements
How and why? Now I am not sure whether the "discussed object" is annotation cell or text node element. Did you do the conversion manually (you dropped the annotation cell) or using some code?
Les Leayr said:I am trying to scan through an attachment that has a clip boundary controlled by a saved view applied
I guess for scanning purpose it's not important how exactly the reference is attached and displayed (saved view + clipping), because it's still represented by standard attachment object.
Les Leayr said:and return the values of the text node elements that are visible in the
Because you are scanning original model, it's crucial to define what object you want to find. When it's annotation cell, you have to search for the cell, not for text (because it's nested inside). I think (but not tested) that in VBA annotation cells are just cells, so they should be included in the scanning results.
Les Leayr said:that are visible in the attachment.
Is it possible to share an example? E.g. to take your sheet and to delete everything on to keep only the source element(s) in reference plus some graphics, to illustrate how it's attached and what is the structure?
D-GEOM-Master.dgn
thanks for the file, it's clearer now ;-)
I see text nodes (so it's about "conversion the cells to nodes) nested in two levels deep in a reference.
It means technically it's to find attachment object representing attached model "Plan 2" (logical "Plan 2-1") and in this model, to find (again) the attachment object representing "Default" model (logical "Plan 2"). In this model (every attachment object is model) you have to scan for the text nodes (or for cells in the originally discussed case).
A question is whether it will provide expected results. When the nodes are in one level and there are no other text nodes, it would be fine. But if your request is to obtain nodes only displayed in the sheet, to scan original source does not provide information whether found text is displayed in the sheet or not, so extra testing is required. Or, maybe, to do it in an opposite direction, and to process a fence created in sheet, because it should contain both active model and all references.
With regards,
Answer Verified By: Robert Hook
Thanks so much Jan, your suggestion to use a fence has worked.
Not sure if I should be starting a new thread but I am looking at returning the element (TextNode) that has been intersected by a line as although the fence method worked it was returning some unwanted values. This is due to stationing text nodes exisitng before or after the matchline and I am attempting to return the stations at each of the match lines.
Alternatively if I could create a fence from the matchline I could then return the value using the fence method.
Any help always appreciated.
Jon Summers said:The text element is a component, or sub-element, of the cell. If you can retrieve a CellElement, use its GetSubElements method.
Oh and Jon's suggestion above woked also.
Les Leayr said:Not sure if I should be starting a new thread
Maybe yes, because it's quite far from the original topic (which was annotation cell in scan) ;-)
Les Leayr said:the fence method worked it was returning some unwanted values
The context is not clear, because we do not know your code and also how the design file looks like.
Also, you do not explain what "unwanted values" are, because what is obtained from fence is one things, but it can be tested and filtered further.
Les Leayr said:This is due to stationing text nodes exisitng before or after the matchline and I am attempting to return the stations at each of the match lines.
I think before any code is written, the rules how to identify right and wrong objects have to be defined. Rarely the problem is inside the code, but in conditions and rules used in the code.