Skip to content

Instantly share code, notes, and snippets.

@GregMalick
Last active August 29, 2015 14:02
Show Gist options
  • Save GregMalick/0e6fab5f75c0b338df14 to your computer and use it in GitHub Desktop.
Save GregMalick/0e6fab5f75c0b338df14 to your computer and use it in GitHub Desktop.
# a snippet from farfarer
# To read the selection sets the polygon belongs to;
# Create a StringTag object - this lets you read tags applied to an object.
# In this case, we're setting it to read tags for the polygon accessor (called polygon_loc in this code).
# Then a quick test to check if it's actually localised OK.
tag_loc = lx.object.StringTag()
tag_loc.set(polygon_loc)
if not tag_loc.test():
return
# So now we can use the polygon accessor to grab the polygon.
# And use the StringTag object to read the tags of a given type from it - in this case the tags of POLYTAG_PICK type.
polygon_loc.Select(myPolygonID)
selset = tag_loc.Get (lx.symbol.i_POLYTAG_PICK)
@GregMalick
Copy link
Author

Snippet of code from farfarer on how to read a polygon's Selection Set

Only vertices and edges have their selection sets stored in vertex maps.
Vertices have theirs stored in VMAP_PICK type maps.
Edges have theirs stored in VMAP_EPCK type maps.
Polygons have theirs stored on tags (of type POLYTAG_PICK) that the polygon is tagged with.

Lots of things are stored as tags on polygons - selection sets, material name, part name, smoothing group and a bunch of font/text-related stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment