Skip to content

Add importStep class method to Shape#2061

Merged
jmwright merged 2 commits into
CadQuery:masterfrom
DavidMStraub:shape_import_step
Jul 12, 2026
Merged

Add importStep class method to Shape#2061
jmwright merged 2 commits into
CadQuery:masterfrom
DavidMStraub:shape_import_step

Conversation

@DavidMStraub

Copy link
Copy Markdown
Contributor

When using purely functional CadQuery, importStep is a bit awkward as it returns a Workplane, so val() or vals() has to be used to return to the world of Shapes.

Since Shape already has other import/export class methods, I thought it fitting to add an importStep method. Obviously, it needs to strictly return a Shape, so if the STEP doesn't contain one, it raises a ValueError.

Before:

import cadquery as cq

shape = cq.importers.importStep("plate.step").val()

After:

import cadquery as cq

shape = cq.Shape.importStep("plate.step")

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.79%. Comparing base (f69500e) to head (9a3411a).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2061   +/-   ##
=======================================
  Coverage   95.78%   95.79%           
=======================================
  Files          30       30           
  Lines        9427     9431    +4     
  Branches     1404     1403    -1     
=======================================
+ Hits         9030     9034    +4     
  Misses        242      242           
  Partials      155      155           

☔ View full report in Codecov by Harness.
📢 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.

@adam-urbanczyk adam-urbanczyk 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.

Thanks! I reworked slightly to reduce duplication.

@jmwright jmwright 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.

Thanks @DavidMStraub

@jmwright
jmwright merged commit 1afb549 into CadQuery:master Jul 12, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants