Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
FreeCAD

You're reading from   FreeCAD Solid Modeling with the power of Python with this book and ebook.

Arrow left icon
Product type Paperback
Published in Sep 2012
Publisher Packt
ISBN-13 9781849518864
Length 70 pages
Edition 1st Edition
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Brad Collette Brad Collette
Author Profile Icon Brad Collette
Brad Collette
Daniel Falck Daniel Falck
Author Profile Icon Daniel Falck
Daniel Falck
Arrow right icon
View More author details
Toc

Importing data (Should know)


Sometimes it is desirable to use geometry that was created in other CAD or modeling programs. FreeCAD can import a wide variety of file types. DXF, STEP, STL, SVG, VRML, Collada, and IDF are just some of the file formats that it can use.

In this recipe, we will open a DXF file and use the geometry in it to form a 3D solid.

Getting ready

You should have a DXF file produced by a CAD program such as QCAD, LibreCAD, Draftsight, or AutoCAD available to produce a DXF file.

  1. In FreeCAD, open the Draft workbench and then select Preferences from the Edit menu.

  2. In the Preferences dialog, click on the Draft icon and then click on the Import/Export tab.

  3. Under DXF format options, change Import style to None (fastest).

  4. Uncheck all the other boxes in that same section. Click on Apply and then OK.

Create some geometry in another CAD program. For this example, we will use DraftSight to create a simple shape. The following is a polyline rectangle with four fillets and a circle:

The lines and arcs in this drawing are a polyline. These will translate nicely into FreeCAD and help us create a solid to subtract the circle from.

Save the file as an ASCII type dxf (don't save as Binary).

How to do it...

  1. In FreeCAD, select Import from the File menu.

  2. Select the dxf file that you want to import.

  3. In the Combo View, look at the Project tab and expand the icons.

  4. Switch to the Draft workbench so that we can Upgrade the Circle with the icon that looks like an arrow pointing upward.

  5. Select the geometry labeled as Polyline and use the Part workbench with the Extrude icon to extrude it into a solid.

  6. Extrude the geometry labeled Circle into a solid. Make sure that its height is the same as the solid made from Polyline.

  7. Select the solid that you created from Polyline and then the solid created by Circle.

  8. Use the Boolean Cut operation in Part workbench to subtract the Circle solid from the Polyline solid.

How it works...

DXF importing relies on code within the Draft workbench, so its settings are controlled from Draft preferences. The dxf polyline imported in as a face that could be extruded in the Part workbench. The Draft workbench has tools for changing other 2D geometry into faces, using the Upgrade tool, which allows the Part workbench to make solids from them. Faces will extrude as solids, whereas a closed shape without a face will just extrude into a thin object that looks like walls.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image