Are there any libraries for parsing AutoCAD files? - autocad

Are there any libraries (preferably open-source) for parsing AutoCAD files (DWG or DXF)?

Well,
For the DXF file format the specification is available online so you can write your own parser for this file format the document can be found here:
http://images.autodesk.com/adsk/files/acad_dxf0.pdf
But if you don't want to you can use libdxf an open source library to parse dxf files but according to the developer it's a “Work in progress” you can find it here:
https://github.com/bert/libdxf
or you can install it in ubuntu using command:
sudo apt-get install libdxflib-dev
Also another library that is provided by coin3d (can be used separately) is named dime and is probably the one used by freecad can be found here: https://bitbucket.org/Coin3D/dime
It also can be installed in ubuntu using the following command:
sudo apt-get install libdime-dev
For the DWG format you can use libredwg library it's from opensource foundation and you can find it here:
http://www.gnu.org/software/libredwg/
But please note that according to Wikipedia it has licensing issues of its own.
http://en.wikipedia.org/wiki/LibreDWG
A fork of libredwg is available under the name libDWG it is able to read DWG file formats R13, R14, R2000 and R2004 and can be found at : http://libdwg.sourceforge.net/en/
I tested the library and the problem is that most of the sample files online have a newer version than the library can load which is not very practical.
Another good page (with some code samples) of how to read autocad files can be found at ibm website here: http://www.ibm.com/developerworks/opensource/library/os-autocad/
Bottom line is using dxf is the better option since it's open and can be supported the dwg support can't be easily done.

Duplicate of (or at least related to) Open source cad drawing (dwg) library in C# & .Net CAD component that can read/write dxf/ dwg files
There isn't anything available for parsing DWG for free that I would regard as reliable. The Open Design Alliance tends to be cheaper & runs on more OS's than AutoDesk's RealDWG offering. The ODA has a price-tier for startups who aren't yet shipping code - RealDWG doesn't. Both the ODA and AutoDesk offer support in forums - you have to be a member of the ODA but AutoDesk's forums are at http://discussion.autodesk.com/forums/ where you can join for free.
DXF is a text-file format (similar to XML) which you can parse with anything you like - if you know what you're looking for. You may have more luck with finding a library for that (I haven't looked into it) but that would involve conversion from DWG format. Note that there are various releases of the DXF format
You can try Autodesk's DWG Trueview (free) but it is an end-user viewer - it doesn't officially offer an API. Some people have had varying degree of success in the past automating it. I haven't tried myself & I strongly suspect the latest versions have been hardened against that.
Ultimately, if you are working for high-profile clients who are likely to insist on, or at least balk at the absence of 'official' AutoCAD libraries and the "Trusted DWG" BS that goes with it then you may need to invest in a membership of the Autodesk Developer Network.
As a long-time end user I can tell you the devs at the ODA are more responsive to bug reports than AutoCAD.

The Ivan CAD Library works very well with DWG R15, R18, R21 and R24. I found it at www.ivancad.com

Related

Convert *.dwg between versions

I am using an off site drafter for much of the drawing work that I have done. My office uses Autocad 2012 LT, while the off site drafter produces files in the 2016 format. In order to edit the drawings I must first convert the files from the newer autocad drawing format to an older format using DWG Trueview. Is there any way to interact with an API to complete this task?
The only programming language I know is python. I know comtypes can interact with the DLL's so its a matter of hooking in.
You can already convert drawings in batch using the DWG Convert tool provided with DWG TrueView, and so in my opinion there is very little benefit to be gained in investing a significant amount of time attempting to automate this process further.
Simply follow the detailed instructions & video tutorial provided here.

Extract pictures from a table in a PDF

I would like to write a small program, or script, to extract a set of pictures from a pdf.
I have several PDFs, they each have a table of pictures. I would link to have one picture per file. Therefore I need a way to extract them. Due to the nature of the PDF (A table/grid), it seems that it would be much easier to write a program, than do some manual method. However I have no idea what tools are available.
What libraries are available?
Preference Python, then C# or Java, then maybe some other language (My C and C++ is rusty, I have not done them for years).
I am on Debian Gnu/Linux, so have a wide choice of tools.
I went with pdfbox (an Apache project, so Free Software) it is a java library and a command line tool (the app module). I then scripted it with a bit of python to process the extracted text (yes it did that as well), and rename the image files.

Is it possible to convert .ppt file to .pptx without using interop or Spire?

Is it possible to convert .ppt file to .pptx without using interop or Spire, because I think it will be something like converting a binary file to open xml format?
Public void ConvertPPTToPPTX(MemoryStream pptFileInput,MemoryStream pptxFileOutput){
.....
}
Thanks in advance.
If you want to do this programmatically you will have to use interop or some third party library.
If you can use interop you will get the fidelity of Office, any other third party library is just a best effort, unless it uses interop under the hood, which some do. Make sure you check if the library requires Office to be installed.
There is nothing built in directly to the .NET framework if that is what you are asking.
Neither will Microsofts OOXML SDK support conversion
The only thing I know of from Microsoft that will do PPT conversion is
PowerPoint Automation Services , but this requires access to a SharePoint Server
http://msdn.microsoft.com/en-us/library/office/fp179894(v=office.15).aspx
This is not an easy problem to solve, in order to do a conversion you have to understand and be able to read in the PPT Binary FileFormat
http://msdn.microsoft.com/en-us/library/office/cc313106(v=office.12).aspx
And then translate that all to the OOXML File format
http://msdn.microsoft.com/en-us/library/dd926741(v=office.12).aspx
All while taking into account the thousands of features the file format supports, the differences in the file formats,the features that are not documented well, and the ones that are documented incorrectly.
What exactly are you trying to solve? A one time conversion, a batch conversion, as needed? Maybe we can provided some other suggestions with more details.

Develop Print Driver

I need to develop a print driver to print from any application into a TIFF file. Does someone know of resources or a good SDK vendor that would enable me to do that? Environment is Windows, any language.
The Microsoft Windows Driver Kit (freely available from the linked Microsoft site) has extensive documentation and examples on writing printer drivers. You can check the online printer driver page of the DDK docs before downloading it.
Edit: One commercial alternative that would probably be much quicker to deploy is VeryPDF's DocumentPrinter. It's rather pricy (currently $1500 for a developer license, $399 for a server license), but from what I've heard their support is rather good so if the price is tenable for you this may be a good option.
There's also a SDK from DirectConvert, but I couldn't find any pricing info and don't know anything about them.
Depending on your usage patterns, another option would be something like TechSmith SnagIt, which has printer capture facilities available. This is not a SDK, though.
Create a raster print driver using the Windows DDK. The sample they provide will do just fine. This will generate bitmaps, which can then be converted to TIFF using LibTiff. Your OEMSendPage function is where you'll want to convert the bitmap to TIFF and save it. If you're unfamiliar with the DDK and Windows print drivers, expect to spend quite a bit of time on this.
I have source for a driver I used to sell that does exactly what you want, but I stopped maintaining it after NT 4 so it's seriously out of date and would require some significant work to make it useful on modern Windows platforms.

What's in your Utility Toolkit? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Some of the most efficient engineers, developers and IT professionals I know usually carry around a common "toolkit" of useful programs, add-ins or utilities which help them for day-to-day debugging, developing or designing.
The question is:
What is in your utility toolkit.. What tools couldn't you live without?
Unix Utilities for Windows
Ack
Its like grep, but better, faster, and does more what you want to generally do with large source collections. Written in Perl, and does complete PCRE because of this. Recursive traversal is default, and it intelligently skips files that are unlikely to match using file-type identification to short cut.
( This means it automatically avoids traversing .svn/.hg/.git directories and thus gives massive speedups )
ack "function\s+foo\s*\(" --php
# find the definition of "foo" in all php files
# decendant of the current directory
Total Commander (GREP, FTP, ZIP, it's all here...I'm not even starting on this one)
Notepad++
WinMerge
Python. Seriously. I use it for a lot of small stuff. I also like to use the command line module for creating easy little project specific "shells" that I drop in frequently used queries etc. (show all tables in the projects db, search for stored procedures etc. - yeah, doing a lot of t-sql lately...)
I tend to accompany big c#/t-sql projects with a little python script that extends the cmd.Cmd class to give me a small collection of helpful queries etc. that I can use to poke around in the database.
Also, I often use python to modify input data (often csv files, but any junk will do) into insert statements etc. Or do plausibility tests on that data.
Currently on my thumbdrive (not ALL software):
Notepad++
.NET Reflector
develop (incase I need a quick IDE setup on a different computer)
C# Default Keybindings pdf
Math tables pdf
Boo Primer pdf
MSDN C# & VB Example projects
My Utility toolkit would have:
1.) Hex Editor - XVI32, or any other
2.) Beyond Compare - Comparison of files
3.) Cygwin shell installable complete with perl, gcc,gprof,gcov,gdb and related tools,bash,vim, development/debugging tools
4.) A model makefile for *nix platform
5.) Winzip utility
6.) Source insight or any other good code browsing tool
7.) Ghostscript and GSView
8.) PDF reader
9.) Good quick antivirus tool/exe
-AD
Currently in Thumbdrive\Tools.
"Edit Plus 3" - lightweight editor that I've been using for ages.
"F# - 1.9.6.2" - great for when I need to throw something togheter since it's usable without an IDE, also a great language for many tasks.
"ildasm"
"Sysinternal Procmon" - great for debugging and getting a feel for what the machine is really doing.
I have the following tools on my USB thumd drive:
SysInternals Suite All their great troubleshooting tools in one download, in case I might need a tool that I didn't download before
WireShark setup
VNC binaries (so I can run the viewer directly from USB) and setup
A couple of Portable Apps:
Notepad++ Portable
Putty Portable
FileZilla Portable
7-zip Portable
Sumatra PDF Portable
WinMerge Portable
I use/carry with me:
.Net Reflector
The SysInternals
Suite (particularly Process Explorer, Debug View etc)
Exescope
Orca (Windows Installer)
Depends
Spy++ OleView
Resourcer
Ethereal
IE Dev toolbar
Depends .Net
DocView
LDP (For LDAP)
Just to name a few
I do a full install of cygwin. It gives me 95% of the stuff I need and hard drive space is cheep. It's a lot easier to install everything then get emacs, gcc, gdb, perl, utilitys such as grep and awk, not to mention the servers it comes with like Apache and MySQL if you want to try something out quick.
grep gives you the biggest bang for the buck. You can use it to search on any type code and many forms of data. It is fast, and very powerful. In code it can locate what you're looking for in variables and function names, but also in comments. You can also pipe results into it, and can thus enhance the utility of many tools available on site.
With some clever hints you can easily make grep search for a specific type of an identifier. For instance, "^function_name" will often find in C code a function's definition, because these start with the name of the function at the beginning of the line. If a search pattern gives you too many false matches, you can filter those out, by piping the result through grep -v.
Many years ago I was stranded debugging COBOL programs on a 1970s-era Perkin Elmer machine running OS/32. The machine lacked programming tools, but had an ancient C compiler (so old, it would accept =+ as the original form of the += operator). I ended up writing a rudimentary grep program, which immensely improved my productivity.
Notepad ++
FF + Firebug
Jquery + bunch of plugins
DBManager
Cygwin for error tracking
Google for help
Docs in CHM & Cheatsheets
I always seem to have a bootable Linux Distro on me in SOME form or other. Whether it be the bootable Pen Drive I keep attached to my Keys, or the multitude of LiveCDs I have for various "diagnostics" - I find that if I am in a situation, generally, where I'd need some sort of tools... a reboot into a Live environment provides me with near enough everything I need, and more
PE Explorer
FAR Manager (great file manager especially when working with lots of ftp sites)
FlexHex
Ida
OllyDbg
Emacs. It's my "does list of things" tool, helpful with quick calculations, with mangling configuration files (I work as a network engineer, there is an awful lot of configuration to be done, lots of it bordering on trivial to generate with either small snippets of code or careful use of keyboard macros).
Here's the tools I use to make Sharepoint solutions:
Visual Studio Team Suite 2008
VSTS Database Edition GDR
Sandcastle
DocProject for Sandcastle
.net Reflector
GhostDoc
CSS Vista
Sharepoint Inspector
Sharepoint Explorer
EditPadPro
CodeSmith 2.6 Freeware (with my own .net 3.5 SP1 gui)
Indigo Rose MSI Factory
Wix
Nmap
Wireshark
Fiddler
Adobe Photoshop CS3
Expresso (Regex tool)
VMRCPlus
Powershell 2 CTP
Quest PowerGui for Powershell
IIS Resource Kit
HyperV
Tools I use because you do not have to install, just drop on system and use:
Agent Ransack
7-zip
PSPad
Robocopy : Need to extract from Windows 2003 resource kit (just grab the .exe)
Fast image viewer that has been around for a long time and proven to work.
IrfanView
ide: visual studio / netbeans (zip file!, almost portable)
editor: notepad++ (portable) with monaco font
file comparison: winmerge (portable)
source control: subversion, tortoise
ticket control: redmine
file manager: free commander (portable)
explorer: IE, FF (portable), chrome (portable), iron (chrom without google crap, also portable), qtweb, arora,
FF plugins: firebug, web developer, xmarks
imclient: pidgin
mail client: gmail
download manager: free download manager (portable)
sites: STACKOVERFLOW!!!, gotapi... and google, all the time...
miscelaneous: launchy (can't live without it!)
virtualization: virtual box (I have a machine image for every environment)
office: openoffice (portable)
lamp stack: xammp (portable!)
disk usage: windirstat (portable), scanner (portable)
pdf viewer: foxit (portable), sumatrapdf (portable)
uncompressor: 7-zip portable
M$ sql comparison tool: sql delta
M$ sql management: visual studio sql manager
mysql
mysql management: phpmyadmin, manager provided with mysql
uninstaller utility: revo unistaller (portable)
registry cleaner: ccleaner (portable)
ftp: filezilla (portable)
as you may have noticed, I have a special predilection for portable applications...
gVim
VS2010 Express
Firefox + Firebug
System Rescue CD
A collection of very useful utilities on a Live CD
There are two tools I simply can't work without
PowerShell
GVim (or really any vim style program)
These tools are so heavily ingrained into my daily routine and greatly increase my productivity.
Since I'm often working on different workstations, I've got into the habit of tagging the stuff that I install on delicious:
http://delicious.com/DavidSchmitt/stdsw
wc.exe (from http://unxutils.sourceforge.net/) so handy.
WinRAR and puTTY. That is all I need (i'm assuming internet doesn't count).
.Net Reflector
Powershell
Stackoverflow.Com
I like to program in Python so I have created a portable Python programming environment on a thumbdrive.
Portable Python 1.0
SPE Python editor
wxPython in Action ebook
Python How to Program ebook
Several Python ebooks from O'Reilly
Various tutorials for Python tools I don't use often
Development Tools
Subversion
Tortoise SVN
Useful tools/utils
Virtual Cd Control Tool
Linq Pad
Reflector
Subversion Commit Monitor
BGInfo
SourceGear Diff Merge
Unlocker
MWSnap
Paint.NET
WinRar
FireFox Add Ons
Firebug
ColorZilla
Visual Studio Add Ins
GhostDoc
The utility toolkit or the Tools List that every developer should have described in the following link from Scott Hanselman:
Scott Hanselman's Ultimate Developer and Power Users Tool List for Windows
I use Espresso (I got it with the MacHeist bundle!), and Firebug for coding. I use Photoshop if I need any images.
I manage my projects with The Hit List.

Resources