Is there any open-source Java or JavaScript library available to parse .dwg files and get the objects from it.
I would like to extract data from a table of text for my project.
It seems that the AutoCAD developer community prefers .NET and C/C++ over JAVA.
The only free alternative I found is by converting .dwg to .dxf first and using the Kabeja lib to read from it.
The Teigha library from opendesignaliance has C++, C#, and Java interface. Teigha is the alternative of RealDWG and it is widely used by many CAD software vendors. It is stable and has the power to read/edit/write dwgs without problem. We have more than 3 years of experience with it and I can say it is excellent and a lot cheaper. When we were at the point to choose between RealDWG and Teigha we chose Teigha and I am glad we did it.
Leveraging SWIG to Create Teigha for Java
In 2013, ODA used the Java support provided by SWIG to create "Teigha
for Java". Teigha for Java includes the following:
Java access to the full Teigha API for both .dwg and .dgn files.
Support for Windows, Linux and Mac platforms.
API very similar to Teigha.NET, simplifying the transition between languages.
Credits to all who have answered, I've tested all your proposition and here's what I've found , as of 2015:
There is currently no free AND reliable solution to read and manipulate .dwg and .dxf files. This applies especially to latest versions of AutoCAD, ex : Autocad 2010, Autocad 2013 etc, RF 2013, RF 2010.
Reliable (and expensive) solutions would be Teigha by ODA (2000$ a year) and RealDWG in C# by Autocad (5000$ a year)...
Cheaper alternatives are as such :
AutoCAD I/O for 10$ per month (as suggested by Augusto Gonclaves), but limited functionalities for now.
writing LISPS routine and running them with a SCRIPT file in a paid instance of AutoCAD 2015/2016..
wait for a more complete implementation of AutoCad Core Console..
Open-source libraries such as Kabeja and YCad may be able to deal with older AutoCAD versions but do not expect much from them as these projects are inactive since a few years ago. It's worth to keep an eye out for Apache Tika though, since they started writing parsers for .dwg files but development has been slow.
On a personal note, I think that AutoDesk has a strong and selfish monopoly on the CAD market now and they are making it difficult for others to join in. The format's version of .dwg files changes so often and I guess open-source developers will have to give up at some point and use the official product instead.
Let's hope for more open-source solutions in the coming years
Autodesk developed AutoCAD mainly with a C++ and offers plug-in support for C++, .NET, JavaScript, VBA and LISP, that's why there is no native Java support. All of those will require AutoCAD installed on the machine.
Alternatively, you can use the AutoCAD I/O webservice, that is basically a running instance on the cloud, to run custom code and extract data or create new drawings. That will have support for all DWG features. Check http://developer.autodesk.com
As you pointed out, use DXF format instead, there is open source java library, YCAD also, that you can use and is very easy to use.
Related
I am looking forward to build a media player with java, and basically what I found was JMF. But, then again, this API is not upto date and doesn't support latest formats such as MKV. On more research, I stumbled upon
Any simple (and up to date) Java frameworks for embedding movies within a Swing Application?
Got all excited, but then digging some more, left me with this
Adding other video codecs / DVD support to JavaFX 2.2
Now, I am disappointed and in a fix that how all the good media players (VLC, KMPlayer etc) been able to support all video and audio formats. They must be build using a programming language, IMHO !
So, my question would be, in-order to build a complete media player which supports all kind of media files:
Is JAVA incompetent ?
Has one ever build a good media player using JAVA ?
Is it just Java or no modern language can do it ?
Do I have rely and choose C, C++ to do this ?
Well, Java is a programming language that was created to support multiple platforms (like Windows, Macintosh and Linux). It works with a virtual machine: a sandbox. So there are a few constrictions, that are based on this sandbox system: Everything, that you want to use in Java must be compatible with ALL platforms, java is created for. And because playing media is very near to the system and of course the hardware (soundcard, graphics board etc), Java may get problems on getting this compatible to all platforms. Another big problem is: Many codecs, you have to read and play (e.g. OGG-Vorbis) are not open sourced, so you will get problems on finding a good API to work with them. Of course there ARE APIs, but I have no experience with them.
Is JAVA incompetent ?
No, but Java was not created, to do system work. Of course, media playing is not a system work, but is near to the system. And Java does not implement codecs for playing music or videos, so you need custom APIs, as I said before.
Is it just Java or no modern language can do it ?
Well the problem is Java: Try a language, that supports more system- and hardware functionality.
Do I have rely and choose C, C++ to do this ?
In my opinion, this is your best opportunity. You may even use VB or VB.Net or whatever, but I think, you will get bigger problems with Java. Of course, this is just my experience, and other people may say you something different, but I think: Yes, C++ is a better language for a media player.
Hope, that answer helped you, greetings
Cydhra
P.S. Sorry, if my English is not that good, it is not my mother language...
The main problem with including more formats in Java by default is licensing restrictions - many of the popular formats are absolutely encumbered with patents and licenses, and for a company like Oracle to support lots of them as part of the JRE just isn't cost effective (in all likelihood.)
However, as mentioned before JFX8 is now open source, and you can thus compile in extra GStreamer plugins if you so choose. I did this recently with MKV, the process is described here if you want to do it with another format.
Since MKV is an open format, I also see no reason in theory why it can't be included in the default classes, so I created a ticket along with the patch - hopefully it may be included as standard in the not too distant future (absolute earliest 8u40.)
If you just want good media support in Java now however, and don't mind having VLC as a dependency, I'd use VLCJ - I use it in my application and it works a treat.
I'm looking to get started with mobile development (specifically iOS), and while I'm usually pretty good at learning languages, Objective-C confounds me at almost every turn. So, looking at j2objc (because I already know Java), I think it might fit the bill in terms of what I'm looking for.
My question, though, is pretty simple: can the converter properly handle a situation where my source code references, say, Apache Commons code in a binary-only (bytecode) JAR file?
No, j2objc requires source code (it uses the front-end of Eclipse's compiler). The RoboVM project works from class files, though.
J2objc is good for writing business logic only once. If you plan to write an app for Android, iOS and GWT, use it. But you will always need to write native code for UI, network and other specific platform stuff (Camera, Geoloc., etc.). If you plan to become a mobile development expert, my advice is to start learning Objective-c right now (I was just like you 2 years ago. I invested time to learn Objective-c and it's the only way to become a cross-platform mobile geek :-). I started with this book : Programming in Objective-C 2.0 (Stephen G. Kochan). Good luck !
No: j2objc requires source code. However j2objc allows transpiling source code that references .jar files. However the jar files with .class files wont be transpiled
I am coming from Java background as well and learned Objective-C by myself (and taught it as well).
If you really want to develop mobile apps for iOS the best thing is to invest in learning Objective-C. J2ObjC is not sufficient to create iOS apps since it does not provide UI support and it is not stable yet (between alpha and beta quality)
J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future.
Objective-C looks strange in the beginning, especially for people with Java or C/C++ background, but once learn it; you will start to appreciate the language.
This is an excellent course to get you started and apple provides excellent resources to learn iOS development and Objective-C.
I strongly doubt that any language translation tool ,e.g. J2ObjC, will be sufficient to build good iOS apps.
Is it possible to use OLE Automation in Java? If not, why is it not possible in Java?
I'm looking to automate the exporting of excel spreadsheets in different format (ie, .csv etc...)
Thanks for the answers in advance :)
Recently (March 2013), an independent contributor added support for generic COM Automation to JNA, which is the last man standing in terms of native platform API integration from Java. JNA is still very actively maintained, unlike Jawin/JACOB/etc.
See here for an example of how it is used. The pre-cooked bindings to the Office APIs are very simple so far, but looking at the code, it seems very easy to use the COM Automation APIs (IDispatch, Variant, etc) to do late binding to almost any COM interface.
I would like to see, however, a more complete binding of the Office COM APIs, since they are by far the most often used COM API in the world. Maybe there could also be an "MSExcel2007.java", "MSExcel2010.java", etc. to cover the different API versions. So it's very much a work in progress, but JNA is now as generally useful for COM Automation as JACOB/Jawin, with the bonus that it's extremely actively maintained (as of April 2013).
You can use JACOB. But there will be some pain involved as it's not documented very well and the performance is not the best. It can also be hard to get it running correctly for you environment depending on which version of Windows you are targetting. I would definitely not use it if you are building a scalable web application. Another option would be Apache POI which has really come a long way from its early roots and is used in alot of production ready tools like JBoss Drools. If you decide to go with JACOB then I recommend you read this SO thread:
Is there a good reference for using OLE Automation (from Java)?
There is a library called JACOB that allows precisely what you're looking for. What do you mean by "from the Java API?" You mean from from the official J2SE packages? I'm not sure how to answer that other than to say that J2SE doesn't include libraries for every conceivable need under the sun, especially those that only work on a single operating system. That's why third party packages exist.
Commercial, but they seem to have a free Open-Source and Academic license...
JExcel
JExcel Developer Documents
I have no affiliation.
In theory, Dalvik executes any virtual machine byte code, created for example with the compilers of
AspectJ
ColdFusion
Clojure
Groovy
JavaFX Script
JRuby
Jython
Rhino
Scala
Are there already working versions of bytecode compilers for Dalvik available for other languages than Java?
At launch, Java was the only officially supported programming language for building distributable third-party Android software.
Android Native Development Kit (Android NDK) which will allow developers to build Android software components with C and C++.
In addition to delivering support for native code, Google is also extending Android to support popular dynamic scripting languages. Earlier this month, Google launched the Android Scripting Environment (ASE) which allows third-party developers to build simple Android applications with perl, JRuby, Python, LUA and BeanShell. For having idea and usage of ASE, refer this Example link.
Scala is also supported. For having examples of Scala, refer these Example link-1 , Example link-2 , Example link-3 .
Just now i have referred one Article Here in which i found some useful information as follows:
programming language is Java but bridges from other languages exist (C# .net - Mono, etc).
can run script languages like LUA, Perl, Python, BeanShell, etc.
I have read 2nd article at Google Releases 'Simple' Android Programming Language . For example of this, refer this .
Just now (2 Aug 2010) i have read an article which describes regarding "Frink Programming language and Calculating Tool for Android", refer this links Link-1 , Link-2
On 4-Aug-2010, i have found Regarding RenderScript. Basically, It is said to be a C-like language for high performance graphics programming, which helps you easily write efficient Visual effects and animations in your Android Applications. Its not released yet as it isn't finished.
Scala works very well.
I'm programming my Android application projects in Scala (Website written in Chinese with some screenshot, source code # GitHub), and it is pretty easy to setup the evnviroment (without IDE, using SBT as build tool).
It could access every API in Android SDK, so anything you could do in Java, you could do it in Scala too.
You may check this blog entry to see how to build Android application with Scala and SBT.
Kawa is a lovely but little known variant of Scheme that has existed quietly for many years and runs on both the JVM and Dalvik, natively. Therefore, its output includes no extra VM and only includes explicitly imported libraries. To the end-programmer, this means Kawa's performance and executable size are nearly identical to standard Java (ProGuard not required).
Kawa also includes lots of macros (including some specific to Android APIs) that make for a nice clean syntax (assuming one is not averse to parentheses), and adds some tasty goodies on top of Scheme, like "promises" (lazy eval and futures in one). The language is quite robust and well-documented, and has been actively maintained and evolving since the early days of Java.
The Java Advent Calendar summarizes Kawa's merits with some informative examples and links.
I haven't played with it but I know that Scala works.
http://www.scala-lang.org/node/160
Another JVM language that works on Android is Kotlin with Anko, both from Jetbrains.
Mercury also works on Android, using its Java backend. I've written a simple app that should help someone get started (there are still few other examples), and mercury-android-helper also for this purpose (although at this exact moment, it's short a few commits. And neither are using ProGuard yet, so the .apk size is shocking.)
Although the other posts here are cheerful about Scala-on-Android, posters in Scala forums are more concerned by Scala's ability to blow through some of Dalvik's limitations, and people who do use it say they reserve it for non-production code. (Some discussion about Scala's problems here.)
I can't say yet if Mercury has its own problems with Dalvik, but I've switched to it from Scala for the time being.
The dynamically typed languages wont be possible until Dalvik supports JIT (Just In Time) compiling. I believe there is JIT support in one of the experimental Eclair branches, but it is not yet officially available/supported in Android.
1) Angular + nativeScript
2) Reactnative
JMF is old, and doesn't support a lot of codecs properly. I get by these days by using FFMPEG in the background, but I would like to switch to a native java solution if one exists, does anyone know of a current open source Java project that has media manipulation functionality?
While not 100% native, you could also use Xuggler. It's an open-source (LGPL) wrapper that runs FFmpeg inside Java so you don't have to shell out, and is used by over 250 developers already today.
It depends what you want to do.
Since you are using ffmpeg, then I assume you are encoding videos. I am pessimistic that Java will do such work 'native' in the short or medium term--it very much goes against many Java philosophies/baggage.
That said, with Java 7, codecs in general should become easier to access, be more available and start showing up in real applications. Unfortunately, from what I've read, the emphasis seems to be on playback and GUIs.
I do allot of shelling out from Java to ffmpeg to encode videos and other media. Fact is, ffmpeg is one of the best tools out there for programmatically encoding videos, proprietary or open source. I predict that it will stay that way for the foreseeable future.
If ffmpeg is just not working for you, then you may want to investigate Quicktime for Java. I personally have not looked to deeply at it, but it seems to be 'big'. Note that it seems to have been deprecated as of the release of QuickTime X (Fall 2009).
QuickTime for Java provides a set of
cross-platform APIs which allows Java
developers to build multimedia,
including streaming audio and video,
into applications and applets.