Closed ChrisWu1997 closed 3 years ago
Great question.
As the segmentation dataset doesn't have the construction sequence information, the way to go about this is to recover the segmentation information from the reconstruction data. Take a look at the thread here, especially the 'Canonical Face Segmentation' part. You will also want to see some of the images in that thread showing splitting and merging of faces.
So this approach will all be inside of Fusion 360. If you are ok working with .smt files in the Fusion API the index of the faces can be used to reference them. If you want to export to step, it is a bit trickier. The workaround we have used in the past is to set a color on the face for each label in Fusion 360, export to step, then recover that color using whatever tool you are using on the step side.
Here is the code to set the color of a face in Fusion 360:
def set_entity_color(entity, r, g, b, alpha=255):
"""Set the color of an entity such as a BRepBody, BRepFace etc"""
app = adsk.core.Application.get()
appearance_library = app.materialLibraries.itemByName("Fusion 360 Appearance Library")
base_material = appearance_library.appearances.itemByName("Base Material - Opaque")
entity.appearance = base_material
opaque_albedo = entity.appearance.appearanceProperties.itemById("opaque_albedo")
opaque_albedo.value = adsk.core.Color.create(r, g, b, alpha)
Hope that helps!
BTW, is the DeepCAD paper yours? Great work! I may ping you with some questions I had about it actually.
Wow, thanks for this quick reply. I'll take a look in detail, but here are some quick questions.
So the index ID of the faces can be used as reference in the .smt file, am I understand correct? I'm not very familiar with Fusion 360 API. Also, is there a correspondence between the two dataset (i.e. the same data ID refers to the same CAD design)? If so, then combine the two dataset might be a quick solution for me.
And yes, we put the DeepCAD paper on arXiv lately. It's still under review. Feel free to ask me any questions:)
So the index ID of the faces can be used as reference in the .smt file, am I understand correct?
Yes the index given in the reconstruction dataset json files (e.g. this index) refers to the face index in the .smt file. So when you load the smt file in the Fusion 360 API you can get that face doing something like:
# Get the first body in the root component
body = design.rootComponent.bRepBodies[0]
# Get the face
face = body.faces[index]
Just note to handle the split and merge faces to get a canonical segmentation you have to reconstruct each file. Code is provided for that in the thread I linked to above.
is there a correspondence between the two dataset?
Yes there is, with some caveats. Take a look at #77 Note that the uuids will not match at the face level as those are randomly generated.
Hi,
I wonder if there are data that contains both construction sequence and segmentation information. Specifically, I need the CAD data with construction sequence and also the correspondence between the final B-rep faces and the features.
I do notice that in the reconstruction dataset, each feature entity in the json file has IDs for the faces that it creates. For example, a
ExtrudeFeature
has a field namedextrude_faces
that gives face IDs. But there is no correspondence of those IDs in the B-rep file (.step
).The segmentation dataset seems to have the correspondence but no full construction sequence.
Will such data that I described be provided or is there a way to work around? Thanks in advance!