Skip to content

Enable multi-color output for 3D printed protein structures - #4877

Merged
peterjc merged 3 commits into
biopython:masterfrom
rob-miller:openscad-multimaterial
Oct 10, 2025
Merged

peterjc merged 3 commits into
biopython:masterfrom
rob-miller:openscad-multimaterial

Conversation

@rob-miller

Copy link
Copy Markdown
Contributor
  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run pre-commit
    locally, and understand that continuous integration checks will be used to
    confirm the Biopython unit tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

This supplies some small modifications to the SCADIO OpenSCAD output code file to enable selecting
portions of a model based on assigned color. The impact is that each portion can be
saved to a separate file, which can be recombined by a "slicer" application that assigns a different
3D printer extruder to each file. The result of this that the structure can be printed using as many
colors as the available printer will support.

There's no obvious testing as the change is not in Python code, however under the previous version
the structure in the attached screenshot could only be rendered in a single color.

Screenshot 2024-11-04 at 16 57 11

Comment thread Bio/PDB/SCADIO.py
//
// Use the colorSel variable to restrict rendered objects by assigned color,
and thereby separate STL files for a multi-material printer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Leading // to match local style

@peterjc

peterjc commented Dec 31, 2024

Copy link
Copy Markdown
Member

Can you suggest another person to review this if @JoaoRodrigues is unavailable?

@rob-miller

Copy link
Copy Markdown
Contributor Author

Does anyone in the review community have any knowledge of 3d printing? Not entirely clear if @JoaoRodrigues has background here either.

@JoaoRodrigues JoaoRodrigues left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I missed this review, sorry Rob. I did use to 3D print models, but never CPK so I'm not a big help here. Colors usually worked fine for me in STL. I assume you've tested this? Otherwise one way is to e.g. upload an STL file to the Shapeways platform and see if the colors show up. I guess you could also use Meshlab or some other open-source tool, but in my experience uploading to a printing service and previewing was the surest way to know things were working..

@peterjc
peterjc enabled auto-merge (rebase) October 10, 2025 11:47
auto-merge was automatically disabled October 10, 2025 11:52

Rebase failed

@codecov

codecov Bot commented Oct 10, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.33%. Comparing base (dd1cabc) to head (0ec0872).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4877      +/-   ##
==========================================
+ Coverage   85.44%   86.33%   +0.89%     
==========================================
  Files         282      282              
  Lines       59443    59443              
==========================================
+ Hits        50789    51323     +534     
+ Misses       8654     8120     -534     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@peterjc

peterjc commented Oct 10, 2025

Copy link
Copy Markdown
Member

I'll rebase this manually...

@peterjc
peterjc force-pushed the openscad-multimaterial branch from d66f461 to 0ec0872 Compare October 10, 2025 11:59
@peterjc
peterjc enabled auto-merge (rebase) October 10, 2025 12:00
@peterjc
peterjc merged commit e451db2 into biopython:master Oct 10, 2025
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