How to get a polygon uuid? if it has one

Do polygons have an uuid? I need the uuid to follow the transformation of the polygon trough my apps.
How can I get it, I went trough the Ruby API but I found nothing.
Does anyone knows how to get the uuid?

Thanks.

How are you getting the reference to this Polygon ?
It’s a collection of edges - found in a number of ways - e.g. by a pick or a selection.
So, c=edges[0].curve gives you the ArcCurve it uses.
Then c.is_polygon? confirms if c is one.

c.methods.sort lists all methods available to you - like entityID. id, object_id and the newer persistent_id ?

You could also add your own attribute dictionary item like:
c.set_attribute(“Frunza”, “polyID”, Time.now.to_f)
e.g. 1501063535.6027951
Then later on use:
polyID=c.get_attribute(“Frunza”, “PolyID”, nil)
If the curve has a polyID set you have it.
So assuming you collect all polygons you want to test in an array named polys
Use:
polyID=1501063535.6027951
polya=polys.find_all{|e| e.get_attribute(“Frunza”, “PolyID”, nil)==polyID}
You are likely to find just one in the matching aray, so:
poly=polya[0]

It depends how you are getting and using this…

Thanks @TIG,
I think I will go with entityID considering that it’s an unique ID, I don’t want to make a custom attribute.

I want to extract all the polygons as lists of vertexes and export them as json file among with the polygon uuid.

I’m curious: what are you going to do with the export? The uuids are meaningless outside SketchUp.

I pass that file trough some services, each service does some transformation to those polygons (changing their size, pruning some vertexes, maybe discard them) and I want to know each polygon’s history. Currently I a have custom implementation for the polygon uuid but I wanted to know if SketchUp provides something similar so I can use that.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.