Code covered by the BSD License  

Highlights from
CAD2MATDEMO.M

4.69231

4.7 | 26 ratings Rate this file 130 Downloads (last 30 days) File Size: 119.55 KB File ID: #3642
image thumbnail

CAD2MATDEMO.M

by Don Riley

 

23 Jun 2003 (Updated 25 Jun 2003)

3D CAD data to MATLAB Converter, CAD STL to MATLAB Patch.

| Watch this File

File Information
Description

CAD2MATDEMO is a demonstration of importing 3D CAD data into MATLAB.

The demo includes:

1) the general program,
2) 4 CAD data file samples, and
3) a simple script that executes the program to show the 4 samples.

To get CAD data into MATLAB, the process is:

1) Export the 3D CAD data as an ASCII STL (or Pro/E render SLP) file.
2) This MATLAB routine reads the CAD data, and
3) Once read, the CAD data is rotated around a bit for viewing.

The program has been tested with: AutoCAD, Cadkey, and Pro/Engineer.
It should work with most any CAD programs that can export STL files.

Format Details: STL is supported, and the color version of STL that Pro/E exports, called 'render' is also supported. The render (SLP) is just like STL but includes color.

Only that data associated with STL or SLP files are translated, e.g., geometry and the geometry color. No textures, transparencies, or other such things are exported with the STL (or SLP) file.

Note: This routine has both the import function and some basic manipulation for testing. The actual reading mechanism is located at the end of the demo file.

Acknowledgements
This submission has inspired the following:
3D Puma Robot Demo, XMas Tree
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (28)
20 Oct 2003 Duane Nightingale

Very nice utility that seems to be working for us right out of the box. Thanks for sharing.

12 Feb 2004 Rajeev Jain  
10 Nov 2004 Fadi Glor

works great - do you have anything for performing boolean operations on stl-files? Like merging two stl-files into one? Looking for the intersection of two stl-files?

19 Dec 2004 Chris Barnhart

Works great!

17 Feb 2005 Tom Mansfield

This has helped me so munch. Thanks.

16 Mar 2006 abelmi ab

I had tried it.It's work good.Nice job

30 Mar 2006 S G

Very nicely done

06 May 2006 H O  
11 Jul 2006 N Q

Works first time. Very useful, but slow for big models.

26 Aug 2006 SIVA PRASAD

I WANT A MATLAB CODE FOR STL OFFSETTING(VERTEX OFFSETTING)
IN MY PROJECT I NEED TO GENERATE A 3D OBJECT WITH GIVEN OFFSET..SO PLEASE UPDATE THIS..

13 Dec 2006 Sebastian Held

great demo; easy to use. Thanks.

15 Jan 2007 Ha Seungwon

it's very good.

23 Jan 2007 Matt Donath

Good demo for small models. However, it took 20 minutes to load a model of a transport vehicle.

27 Jan 2007 abelmi ab

Look great

05 Jun 2007 Roland Lehmann

Great program that saved me a lot of time. Thank you for sharing!

09 Oct 2007 Raphael Beckers

Exactly what I was searching for. A little bit slow, yes, but I have no Idea how to make it faster.

12 Oct 2007 M Genest

Great tool

I strongly recommend you modify the file opening function to pre-allocate the memmory. This allow to open large model a lot faster.

This can easily be done

09 Mar 2008 Scott Burnside

After adding some preallocation I found this code to be very simple, straightforward and robust. This example is particularly useful to me as I am writing a 3D track display and was able to write a process based on your example so that we could develop our track symbols in autocad and bring the vertices and faces into Matlab as a patch object. An amazing combination of tools. Thank you for sharing.

27 Mar 2008 igor scardanzan

what one needs to start exporting matlab patch in CDF pre processing tools
just slow in writing the STL file

24 Jul 2008 Sharina S

Great work indeed.This helped me in my project.

22 Aug 2008 Greg C

Any suggestions on the memory pre-allocation? I made several attempts unsuccesfully.

12 Mar 2009 Husam Aldahiyat  
04 Apr 2009 Alex Frid

Hi,
i have tried to load a different 6DOF arm in to the code and bumped on problem of the initial location. How do you set what the initial location of each part before you performing the InitHome function call.

22 Jun 2009 badr Higab  
02 Mar 2011 William LaCava

A note to SolidWorks users: be sure to export your STL files as ASCII, not binary. To do this for a solid part, hit 'saveas', choose *.stl, and go into Options. In my case, solidworks defaulted to export in binary.

10 Mar 2011 Jeroen Vandersteen  
08 Apr 2011 YT

very good tools!thank you

05 May 2011 Joachim  
Please login to add a comment or rating.
Updates
25 Jun 2003

I have just updated the file (R2), due to a capitalization issue on some internal functions that kept the rotations from working. The demo should be working correctly now.

Tag Activity for this File
Tag Applied By Date/Time
data import Don Riley 22 Oct 2008 07:03:29
data export Don Riley 22 Oct 2008 07:03:29
3d cad Don Riley 22 Oct 2008 07:03:29
translation Don Riley 22 Oct 2008 07:03:29
stl Don Riley 22 Oct 2008 07:03:29
dxf Don Riley 22 Oct 2008 07:03:29
proe Don Riley 22 Oct 2008 07:03:29
autocad Don Riley 22 Oct 2008 07:03:29
data import Ethan 12 Mar 2009 02:07:59
stl Gav Dooley 03 Dec 2009 09:50:24
dxf Claude Gronfier 12 Mar 2010 08:23:01
proe Rolf Winkler 04 Jan 2011 02:28:59
autocad nadim maamari 01 Oct 2011 08:22:54
proe Nirav Chudasama 16 Oct 2011 12:54:49

Contact us at files@mathworks.com