Quantcast
Viewing latest article 24
Browse Latest Browse All 5809

Face materials and headless Rhino Document

Hi @dale I’m opening a new topic related to this, because I’m finding that I cannot access face materials when opening a headless Rhino and I wanted to check with you if this is normal behaviour.

The following code:

obj = document.Objects.FindId(System.Guid('c9cb3490-c171-47fb-b41d-da3d04e28af8'))
for ci in obj.SubobjectMaterialComponents:
            face_mat = obj.GetMaterial(ci)
            print(ci.Index, ci.ComponentIndexType, face_mat, face_mat.Id)

works differently if the document is an active open model or a headless opened document, that is:

If I am in an empty document and load another document in headless mode with:

document = Rhino.RhinoDoc.OpenHeadless(this_file_path)

I get the obj base material it has assigned and no face material data:

0 BrepFace Material: M_Material_ZZZ (1352) a106bd85-401d-4a8e-bcb2-66bb9c0f6b5b
1 BrepFace Material: M_Material_ZZZ (1352) a106bd85-401d-4a8e-bcb2-66bb9c0f6b5b

If I open the model and access the RhinoDoc instance with

document = Rhino.RhinoDoc.ActiveDoc

I get each face material data as expected.

0 BrepFace Material: T_Tx01 (1332) 57c9d9d1-9dc8-44b7-87b2-8e92606c911b
1 BrepFace Material: T_Tx02 (1087) f80e9001-dc6a-43c7-85e7-a565b3449481

I want to compare face material data between versions of a Rhino file so I need to open both versions in headless mode to do that. For geometry comparissons and attribute data, everything works as expected, but with material data it does not.

Can you comment on this?

Thanks!

5 posts - 2 participants

Read full topic


Viewing latest article 24
Browse Latest Browse All 5809

Trending Articles