Skip to content

Conversation

@CharlesPignerol
Copy link
Contributor

Optional definition of display colours for geometric entities according to the name of their group of belonging.

To try it, run Magix3D as following :

Magix3D --groupsColors rgb.xml

where rgb.xml contains :

<Section name="ROUGE" type="container">
  <element name="color" type="color">
    <red>1.</red>
    <green>0.</green>
    <blue>0.</blue>
  </element>
</Section>

<Section name="VERT" type="container">
  <element name="color" type="color">
    <red>0.</red>
    <green>1.</green>
    <blue>0.</blue>
  </element>
</Section>

<Section name="BLEU" type="container">
  <element name="color" type="color">
    <red>0.</red>
    <green>0.</green>
    <blue>1.</blue>
  </element>
</Section>

Here are a few Python commands to execute in the console to illustrate the point :

cmd = gm.newBox (Mgx3D.Point (0, 0, 0), Mgx3D.Point (1, 1, 1), "ROUGE")
gm.addToGroup (cmd.getSurfaces ( ), 2, "ROUGE")
gm.addToGroup (cmd.getCurves ( ), 1, "ROUGE")
gm.addToGroup (cmd.getVertices ( ), 0, "ROUGE")
cmd = gm.newBox (Mgx3D.Point (1, 0, 0), Mgx3D.Point (2, 1, 1), "VERT")
gm.addToGroup (cmd.getSurfaces ( ), 2, "VERT")
gm.addToGroup (cmd.getCurves ( ), 1, "VERT")
gm.addToGroup (cmd.getVertices ( ), 0, "VERT")
cmd = gm.newBox (Mgx3D.Point (2, 0, 0), Mgx3D.Point (3, 1, 1), "BLEU")
gm.addToGroup (cmd.getSurfaces ( ), 2, "BLEU")
gm.addToGroup (cmd.getCurves ( ), 1, "BLEU")
gm.addToGroup (cmd.getVertices ( ), 0, "BLEU")

@nicolaslg nicolaslg force-pushed the materials-colors-dev branch from d8615be to 38053bd Compare November 27, 2025 08:44
Copy link
Collaborator

@nicolaslg nicolaslg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I rebased on the main branch and skipped the commit b86be47
    that seemed to be related to #172

@nicolaslg
Copy link
Collaborator

Works great, the rgb.xml file for testing should be completed with

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<GroupProperties XMLLoader_version="0.3.0">
  <Section name="Groups" type="container">

    <Section name="ROUGE" type="container">
      <element name="color" type="color">
        <red>1.</red>
        <green>0.</green>
        <blue>0.</blue>
      </element>
    </Section>

    <Section name="VERT" type="container">
      <element name="color" type="color">
        <red>0.</red>
        <green>1.</green>
        <blue>0.</blue>
      </element>
    </Section>

    <Section name="BLEU" type="container">
      <element name="color" type="color">
        <red>0.</red>
        <green>0.</green>
        <blue>1.</blue>
      </element>
    </Section>

  </Section>
</GroupProperties>

@nicolaslg nicolaslg merged commit 25796df into main Nov 27, 2025
2 checks passed
@nicolaslg nicolaslg deleted the materials-colors-dev branch November 27, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants