library/language to create engineering drawings - java

Anybody have some experience with the graphical languages which is primarily designed for drawing? My question is about an alternative to AutoCAD and/or similar drawing software in terms of writing code to create the drawing. I couldn't find any of those types of languages if exists, primarily designed for as programming engineering drawings.
For example: I want to be able to create cylinders, rectangle, circles etc given the size and want to be able to manipulate those with adding, subtracting, extruding and so on...Also some annotation features would be great.
Update: As far as I have made my research, I think creating some engineering-drawing library atop of blender (which is itself a nice animating tool) might be great. Does somebody knows of anything that is in progress or already exists in this field?

The LaTeX world has long history of attempts to express line art diagrams in the document source code. The current favourite seems to be TikZ.
Examples
"3D" tagged examples
However, it falls somewhat short of providing full CSG (Constructive Solid Geometry) support.
If you do want 3D and CSG, POV-Ray lets you create objects and scenes by editing good old text-file sources (reference, examples). But on the other hand, POV-Ray won't generate engineering-style line drawings so far as I know.
With regard to your updated question: be aware that Blender already has a very nice Python API (and the ability to get a Python shell in the app) which lets you get at virtually all the Blender state and is probably the easiest way to implement extension plugins for procedural modelling, applying effects and import/export to other formats. Maybe it would work for "drawings" too. Whether it's useful also depends how important you regard the Java aspect; I'm not aware of a Java API but I have written C++ apps which exported models in the form of python code to be executed by Blender.

I'm not aware of anything that most people would recognise as a programming language which was primarily designed for CAD and similar applications. I would hazard a guess that most of the well known CAD packages (commercial and open-source) are written in Fortran, C or C++. sure, they may use something else for GUIs and such like, but the hard-core comp-geom stuff is going to be in a classic, compiled-for-speed, programming language.
There are languages (eg LOGO) which provide native support for drawing operations, but I'm not aware that any of these have been successfully used in published CAD systems.
It is not, though, a coincidence that many introductory texts on object-oriented programming take their examples from the domain of drawings and shapes -- you know, a Shape is the super-type of a Circle and of a Rectangle and of a Polygon; all of them implement the Draw method, and so on. The rise of OO is intimately tied up with the rise of graphical programs.
Finally, you might be interested in Processing.

Related

Is there a way to generate Java code from UML Activity diagrams in Netbeans?

I have seen previous questions on how to generate UML diagrams from code. Is there a way to do it in reverse, like having an existing activity diagram to convert into Java code?
This would be possible. ADs have quite a limited number of language constructs. Decision would translate to a simple if construct. CallBehavior would just be invocation of a class operation. And Fork/Join would need some support to be mapped to invocation of system threading operations.
But that's not all of it. I don't know of any system that's described in full with ADs. There are usually only a few ADs and many (/most) use cases are just described in text.
There's executable UML which might be something you can look into. I haven't seen it in reality in any project. To me UML is for (abstract) modeling. You don't bother too much with implementation. Then you pass on to the coder/hacker troop. They live in a somewhat different world. And you won't make them happy when doing all the programming already in UML. And for sure you won't get them into programming in UML.
It is impossible to generate working code from UML. You can only generate objects with empty methods.
Enterprise Architect can do that, for example. It can also reverse engineer existing classes. But both features are (in my opinion) much less useful as it sounds. At the end, you make the work of the programmer more complicated as before. These diagram can even not replace manually created documentation.

Designing a UI for Programmers to Use

I am doing UI design for a group of programmers who are working on building music-related software. I have created .psd files for all of the mockups, graphics, etc.
I was assuming they just needed the (many) images to put into the code, but they want me to use a GUI to spit out the necessary code. (I looked at Antetype, but it just seems so basic compared to my Photoshop mockups.)
My question: Is there a GUI tool that can build VERY UNIQUE designs, and can export the mockups in code using MatLab or Java? -- Or should I just say no and give them the images to use in the code. (we are talking guitar-pedal knobs, EQ sliders, etc.)
Netbeans has a decent swing WYSIWYG editor for Java GUIs that's certainly worth looking into. There's going to be some significant back-end work getting your graphics to look just right if you have particular/complex designs in mind, but that said customizing Java GUI's is much easier than MATLAB. . . I believe eclipse also has plug ins available for this same sort of thing.
Anyways, that is probably the closest you'll get to a nice drag-n-drop interface in Java for GUI design.
JFace is also a pretty spectacular framework that sits atop SWT for building Java GUI's. I would say that it's power lies in how it handles different windows/components, but of course the trade off is that it's more complicated to put together (no WYSIWYG that I know of)
Also consider the Microsoft route, Visual Studio is designed to take the pain out of layout designs in writing Visual Basic/C#/.net applications. If you're a student your university probably has a deal to get you a free copy (mine did) otherwise visual studio express should be free (I think? ...citation needed?)
To create a UI you can use some tools, Netbeans in first .. but i think that is better to create a consistent code using simple layout and component, so doing it by hand (Oracle interesting tutorials). If you aren't a java programmer i suggest you can simply give them your image.

Java Monkey Engine Tutorial

I've worked my way through the tutorial series of jme and feel like I've understood the basics. Now I would like to create a first very simple game. Nothing fancy just a simple test scenario: The player should be able to move an object. Then I would like to expand it. However I don't know how to start. It's hard to explain but I just don't know where to put my code. The manual says that there are "controls" (implemented as interfaces) that let you hook your code up to frequent update calls or other events (that's what I understood) but I can't grasp how to use them.
More detailed description. You could skip this:
To get the point clear - I'm coming from the engine Unity3d. The usage was quite pleasant, the community helpful and the documentation great. But you have to spend about 1000$ to get the full version and be allowed to use pro features (shadows, custom shaders, some advanced tools,...). After a while the temptation of open-source was simply to big. In unity3d you basically have an advanced 3d editor and a scene graph. You can place objects in the scene and access and modify them over the scene graph. You can use predefined objects such as lights or particle systems and change them to suit your needs but most things you use are custom made and puzzled together by different components: a mesh, a collider, a few scripts. And this is where your code comes to work. In unity3d your program is split into small scripts and these are added to the objects of each scene. The scripts have access to the underlying engine, the properties of their object and can use a special framework for math, networking,... Each script can also define functions to be called in certain events: update(), onCollisionEnter(Collider other), onTriggerEnter(Collision other), ...
This was extremely easy to use. Admittedly huge architectures can be difficult to implement but this setback was complemented by very high productivity.
Frankly: I need advice how to structure a simple game with JME.
What architecture do you recommend ?
How are controls used ?
I would appreciate a link to a tutorial (I already read the flagrush series) or any other resource.
Thank you for your help
I'm not sure how well you read the tutorials but they quite literally explain the things you asked for.
Anyway, you code everything so you don't add an object and put code in it you instance an object trough code.
Input is handled by the InputManager, as long as you still use SimpleApplication as foundation you don't have to think about it and use it the way you learned in this tutorial

GUI in Java, Backend in SML?

I'm a big fan of functional programming languages (namely Standard ML and its dialects), mainly because of their expressiveness which allows for very consise, clean code. I can solve many problems dramatically faster with ML than with say Java.
However, Java is really great when it comes to programming GUIs (->SWT). I would definitely not wanna do that in a functional language.
This brings us to my actual question: Is there a good way to write a program in ML and then wrap it with a GUI written in Java?
What I have come up with so far is the following:
Compile the ML programm (e.g. with MLton or Poly ML) and execute the binary as
an external program from Java
(http://www.rgagnon.com/javadetails/java-0014.html).
Problem: The only way the Frontend/Backend can communicate is via Strings. This might require tons of (difficult) encoding/decoding.
Use JNI/JNA. From what I read, this will allow you to transfer Integers, Arrays etc. I think the external programms have to be written in C/C++ for this to work. With MLton's Foreign Function Interface I can write an Interface to my functional program in C and statically link the whole thing.
Problem: Apparantly, this only works with dynamic libraries, that is dlls in Windows. However, MLton will only let me compile the ML/C Programm to an executable. When trying to create a dll, I get a whole bunch of errors.
Does anyone have experience with this? Is there a better way to do this?
Thanks in advance! -Steffen
EDIT: I know about Scala which tries to bring concepts from functional programming to Java. I have tried it but I dont think it can compete with an actual functional programming language (in terms of expressivness)
That's not quite the exact answer but there is a functional language which is very ml-orientated for the JVM: Yeti
So if you like coding in ML than that's probably currently the closes you can get on the JVM and it integrates of course very well with all the Java APIs.
Is there a good way to write a program in ML and then wrap it with a GUI written in Java?
I don't know if this is a good way for small applications, but it is definitely a way, one that works for big IDE style stuff: Isabelle/ML vs. Isabelle/Scala/JVM. This is an application of interactive theorem proving, but plain SML programming is a trivial instance of that, in a sense.
So you can write basic Isabelle/ML code that emits some messages in the manner of the old-fashioned REPL, but the output can be interpreted by GUI components on the JVM side. Isabelle/jEdit does that routinely for pretty-printing of colored text, with a tiny little bit of rich text (sub/superscripts and bold).
Concerning explicit recoding of functional values over pipes/sockets as strings: that turns out quite simple in Isabelle/ML/Scala, due to some imitation of the way SML would represent typed values in untyped memory, but using untyped XML trees here instead of bits. The XML transfer syntax is specific to keep things simple: YXML instead of official quasi-human-readable XML. All of that fits into approx. 8000 bytes of SML source -- I am tempted to post the sources here, but better search the web for "Isabelle YXML" or "YXML PIDE".
Since Scala/JVM alone has been mentioned as standalone alternative: it definitely works, Scala is also very powerful and flexibile in imitating many programming styles (higher-order functional-object oriented), but for sophisticated symbolic applications like theorem proving, it just won't reach the purity and stability of SML. (Note that the underlying SML platform here is Poly/ML.)

Creating a Digital Audio Workstation

I am trying to write my own DAW, mostly just to learn about the mathematics of how signals are processed to get effects, but also for fun. (A rather large undertaking, but I have the time at the moment). I would like for it to work something like Propellerhead's Record as in the rack especially.
I'm running on a Mac, so I'm thinking of using Audio Units for the different parts, then Core Audio for the scaffolding parts. So, the whole thing would be written in C or Obj-C.
However, I haven't used either Audio Units or Core-Audio before, and the internet hasn't been any help for learning.
Does anyone know where I could learn about these?
Or would Java (The only other language I'd feel comfortable using) be better, or is there something I've completely missed while trying to find the "easy" way to do this?
Thanks,
Jon
if you want to write a DAW:
at minimum, get your feet wet with an existing project. if i were to personally choose a project, i'd contribute to Ardour.
the signal processing in a DAW is relatively simple. you'll have to work with mixers, files, and graphics. if you're already comfortable writing apps, then you probably won't learn much (beyond the basics). of course, you could find an existing project and extend it with features which relate to what you want to learn; you could write plugs or visualizations for it.
if prefer to work with signal processing:
AU or VST plugins will be a good intro - there are many existing projects which you may reference. eventually, you'll get tired of waiting for a host to load to test your program.
language:
objc is not usable for realtime audio rendering.
java is very unusual for this application. there are actually wrappers for AUs and CoreAudio... but can't name one commercial Java AU for OS X.
most audio shops (that I know of) are using C++ - not C. (Hardware is different). this really seems like an odd omission from your list - most DAWs and plugins use C++, and that is the language you'd find the most examples in. if you're already comfortable with C and Java, I'd recommend coming to terms with C++ because that's the standard language in the industry when targeting desktops.
Look at the cross platform C++ library JUCE, it is open source with the option to license the code (price isn't bad).
Plenty of professional DAW and VST developers use it, I'm one of em.
https://www.juce.com/
Warning, this library is a lot of fun to play with. It renewed my interest in C++, which was no small feat.
you are right-on in assuming that core-audio and audiounits could form the basis for a system (that may not need to be a fully-fledged DAW but may have some combination of multi-track audio recording, editing, playback, etc...) much easier than worrying about cross-platform concerns, massive all-encompassing frameworks like Juce, or ASIO and other os-bypassing hacks. i think you will find that audio programming is a specialized discipline and most folks here on stackoverflow are ill prepared to offer useful advice.
Java is rather unsuitable, as is C#, as are interpreted languages FOR AUDIO, in particular for multichannel audio, DSP, etc. due to time contraints and the need to work on a rather low-level for many critical loops.
you will find the documents you need on developer.apple.com (you'll have to make a login) and you can find shell-examples for your interest directly inside of xcode examples...
good luck

Categories