How to read EMF - Enhanced metafiles? - image

Does anybody know of a library or a piece of code that can read EMF (Enhanced Metafiles). Ideally it would convert an EMF to a list of drawing commands and objects?

The Apache Image Loader Framework (Java) can read EMF file and convert then to SVG, it can also read WMF using 3rd party plugin.

What language are you working in ?
You might look at our MetaDraw ( available as OCX or .NET Winforms component )
This will load EMF files and allow you to cycle through the elements ( lines, shapes, text ). You can then identify the parameters ( coordinates, line thickness, colors, etc) More details at www.MetaDraw.com

LibreOffice can do it. There is also a python utility called unoconv which will do it (using installed LibreOffice libraries). You could look at those for some hints on how it's done, since they're open source.

Wikipedia article on Windows Metafile has a lot of relevant information on EMF. Check external links for libraries and format specification.

Related

.obj to fbx exporter and vice versa

Does there exists any command line tool that helps you import/export obj/fbx files.
I couldn't get the autodesk fbx converter to work.
Any decent package preferably CLI tool out there that does the heavy weight lifting or if there's any three.js converters.
For converting various 3D file formats, you can use assimp (https://github.com/assimp/assimp).
A library to import and export various 3d-model-formats including scene-post-processing to generate missing render data.
It also provides a CLI tool (which you have to build yourself).
However, it states that FBX export is still experimental. But give it a try!
EDIT: I just see, there is also a compiled version by now (if you are working on Windows): https://github.com/assimp/assimp/releases/tag/v4.1.0
You have to look for assimp.exe.
Docs on how to use CLI tool should be in doc/AssimpCmdDoc_Html/AssimpCmdDoc.chm, which is, however, a bit outdated.
Basic usage is:
assimp.exe export input.fbx output.obj [additional parameters]
See assimp help and assimp export --help for additional help.

ActionScript how to compile .as to binary machine readable format

I am looking for an option for converting my .as ActionScript3 files to binary format before distribution. I tried mxmlc and compc but both are converting source to bytecode which is reversible. Is there any way to hide your source code completely?
thanks in advance
BB23850
As Flash Players can only read bytecodes, but not binary machine code, it is obvious you won't be able to do so. But there are other means of obfuscating your code from getting decoded easily.
If your target is to create stand-alone executable files, then consider SWFKit Pro or similar application. SWFKit store swf as encrypted file, only decrypt when required.

how to deal with dwg file

I want to use code to analyze dwg file. Any one know any SDK tools to start with?
From Wikipedia:
Autodesk sells a read/write library, called RealDWG, under selective licensing terms for use in non-competitive applications. Several companies have attempted to reverse engineer Autodesk's DWG format, and offer software libraries to read and write Autodesk DWG files. The most successful is Open Design Alliance, a non-profit consortium created in 1998 by a number of software developers (including competitors to Autodesk), released a read/write/view library called the OpenDWG Toolkit, which was based on the MarComp AUTODIRECT libraries. ODA has since rewritten and updated that code.
WoutWare's cadlib supports WinForms embedding and a few other things.
If you don't have any AutoCAD or compatible CADs, there are several OSS libraries that can handle DXF. ODA provides a free (unfortunately not open-sourced) tool ODA File Converter that converts DWG to DXF. Notably, ezdxf has a wrapper API for the ODA converter.
from ezdxf.addons import odafc
# Load a DWG file
doc = odafc.readfile('my.dwg')
# Use loaded document like any other ezdxf document
print(f'Document loaded as DXF version: {doc.dxfversion}.')
msp = doc.modelspace()
...
# Export document as DWG file for AutoCAD R2018
odafc.export_dwg(doc, 'my_R2018.dwg', version='R2018')
There is also LibreCAD's module libdxfrw, but I haven't tried it.

Doxygen equivalent for Mathematica?

How do you put additional information into a Mathematica package file, like
parameter specification
doctests/example usage?
Up to now, I only found the ::usage string and some information on how to write documentation notebooks. I am looking for an option to generate these documentation notebooks from introspecting package files.
I don't know that there is any mechanism such as doxygen built into mathematica. If you want to embed a documentation notebook into your package I would proceed as follows
Write up the documentation notebook
Embed the notebook as a character string in your package
Write a help function that, when called, crates a file, writes out the notebook and uses front end manipulations to open it
You might be able to skip the creation of the external notebook by using Notebook[] instead of a character string for storing the documentation notebook inside your package file.
Integrating with Mathematica's own Help system is a bit more difficult (as the link you gave explains). Of course, you could still have the package write and move the appropriate files into place when the package loads.

Visual Studio Language Service with C# intellisense

Last year I wrote a Language Service for Visual Studio which added syntax highlighting for NHaml files: http://github.com/snappycode/hamleditor.
To clarify, NHaml is a html template language that can mix in code elements like an aspx file can. This plugin adds support to the IDE for editing NHaml files, but basically only adds syntax highlighting.
I was wondering if anyone knows how to add inline c# intellisense to the service like you get now in an aspx file. I'm hoping that would be possible without doing the whole c# grammar myself specific for the plugin.
Has anyone written a language service that mixes languages?
UPDATE:
It looks like the spark view engine guys have made some inroads here, I am investigating their implementation
I checked the Spark View Engine, and they seem to have made a generic ATL stuff (called SparkLanguagePackageLib), that in fact seems to be not containiag anything Spark specific. It seems to be just a generic C# intellisense library that needs the following:
The original code
The C# source that gets generated from the original code
The position mappings between the two (for example the code on line 2 pos 5 gets mapped in the output to line 4 pos 10, etc.)
Some other things, like Paintings(?)
And after that you can call:
events.OnGenerated(
primaryText, // original source code
entry.SourceCode, // generated sourcecode
cMappings, // mappings between the two
ref mappings[0], // ?
cPaints, // ?
ref paints[0]); // ?
I've tried to find Spark-specific stuff in that C++ library, but I couldn't find anything: everythig spark-related is split to a separate C# code file. I think this is good, because:
You don't need to edit the C++ files
If the spark view engine's intellisense support is installed it can be used by other view engines too
You only need to create a class, that maps between the original nhaml file and it's generated C# counterpart.
Btw. Are you still working on this NHaml Intellisense library? If not I'll try to patch their implementation in hope it can be converted to NHaml easily.
this looks like it might help
http://www.codeproject.com/KB/recipes/VSLanguageService.aspx
I finally managed to modify the code to support NHaml. It wasn't that hard at all. Unfortunately the original NHaml library doesn't support everything that was needed, so I had to create a new parser for NHaml. It doesn't support all of the constructs, but it supports most of them (enough to make NHaml programming easier)
Download: http://github.com/sztupy/nhamlsense
Screencast: http://www.youtube.com/watch?v=8jTZ2zC9eYc
You can easily add keywords by creating or modifying a usertype.dat file. Check here for some directions on attaching to specific file extentions. That might get you at least part of the way, without redoing the complete c# syntax.
(In fact, I'm not sure what you mean exactly by 'syntax highlighting' in this context. I'm sure, for instance, you get brace-match highlighting for free in the editor).

Resources