Importing STEP Files

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
Bayesian
Posts: 90
Joined: Thu Aug 08, 2019 1:49 pm

Importing STEP Files

Post by Bayesian »

I'd like to import STEP files through the Python API.

The only way I found so far is "Import.import". Side Note: "Import" is a legal name for a module, but maybe not the most appropriate...

But that function always returns None. It creates a new document with one object. You can also add the "Name" of an open document, which is also kind of inconvenient.

Is there any way to import a STEP File to a Shape object or similar?
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Importing STEP Files

Post by easyw-fc »

Open the python report panel, open the document in which you want to import your step file. Then from the menu use the import function.
In the python report panel you will see the python code to be used.
Bayesian
Posts: 90
Joined: Thu Aug 08, 2019 1:49 pm

Re: Importing STEP Files

Post by Bayesian »

Yes, I did exactly that and had the problems mentioned above.
Bayesian
Posts: 90
Joined: Thu Aug 08, 2019 1:49 pm

Re: Importing STEP Files

Post by Bayesian »

Thank you, "Part.read" is what I was looking for.

The other way is extremely clumsy...
Post Reply