AttributeSets findObjectsByPattern

AttributeSets findObjectsByPattern

Cadkunde.nl
Collaborator Collaborator
211 Views
2 Replies
Message 1 of 3

AttributeSets findObjectsByPattern

Cadkunde.nl
Collaborator
Collaborator

Hello Forum,

 

https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=AttributeManager_FindObjectsByPattern

 

I'm making use of attributes for a project.
And I'm very pleased with the AttributeManager.FindObjects function.

But, It only finds Attributes with a certain value (=) and not higher or lower (> or <)

 

And I need that, for example delete any workpoint with X > maxX or Y > maxY or Z > max Z

Then add any workpoints with with an X Y Z value not already in the document

 

Ofcourse, there are ways to do this with .FindObjects

But how great it would be to do in 1 search, and maybe FindObjectByPattern might be a solution here.

it doesn't happen very often, but there is nothing on the internet about it.
How to use this Xpath as string?

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

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Cadkunde.nl.  This is an interesting thought.  I can't remember ever using that FindObjectsByPattern method, but am interested in it.  I am aware of the AttributeSets.DataIO route, then using its DataIO.WriteDataToFile method, for writing AttributeSets data out to an XML file.  The same is available to the single AttributeSet object.  I am vaguely familiar with navigating XML using an iLogic rule, but just barely, so not that experienced with it yet right now.  I guess you could experiment with exporting some AttributeSets / AttributeSet data to XML, then opening that document in an appropriate viewer/editor, to see how it is all laid out inside.  Then that may help to understand what would need to be specified for the XPath input.  Below are a couple related links.

https://learn.microsoft.com/en-us/dotnet/standard/data/xml/select-nodes-using-xpath-navigation 

https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/visual-basic/language-compiler... 

https://stackoverflow.com/questions/16949495/using-xpath-and-vb-net-to-parse-xml-containing-namespsa... 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Cadkunde.nl
Collaborator
Collaborator

Hello,


Sorry for the late reply. I thought I had to look in that direction, but I was wrong.
I think that findbypattern is more to check if the Attributeset has a certain set of named attributes.
Which is not really the direction i want to go.

 

I'm now using 'object oriented programming' I just collect all the existing sketchlines with "Attributemanager.findObjects", extract values from attributes and cast them in objects which I can then search in.