cancel
Showing results for 
Search instead for 
Did you mean: 

DWG 'file properties' extraction

pnacci
Champ in-the-making
Champ in-the-making
Hi all, I'm trying to get metatada from DWG. To do it I wrote some code in plain "C" which reads DWG (2004, 2007, 2010) from a file (or stdin) and gives me this output:

<?xml version='1.0'?>
<dwgprops>
        <title>TITLE-TEXT</title>
        <argument>ARGUMENT-TEXT</argument>
        <author>AUTHOR-TEXT</author>
        <keywords>KEYWORD1,KEYWORD2…</keywords>
        <comments>COMMENT-TEXT</comments>
        <lastuser>LAST-SAVED-BY</lastuser>
        <hyperlink>BASE-HYPERLINK</hyperlink>
</dwgprops>

I could not write it with Java because I'm too "java-noob"  Smiley Surprisedops: so the question is:
Metadata Extracter can run external commands (like Content Transformation)?
If yes I could chain execution of my little program with XML metatada extractor.

If not, is anyone interested in dwg extraction code (ansi C) to convert it to an alfresco Metadata extracter bean?
8 REPLIES 8

derek
Star Contributor
Star Contributor
Hi,
I think that it would be much better to extract directly using Java, even if the Java implementation uses a RuntimeExec to call your utility.  Chaining with XML metadata extraction will create unnecessarily complicated config where it's not really required.
Regards

pnacci
Champ in-the-making
Champ in-the-making
Thanks derek, I'll try to convert my C code to Java, unless someone much skilled than me (it's not difficult) would like to do it (I can give you my code) and share to Alfresco community; getting properties from Autocad files is not currently supported by Alfresco and there's no free, integrated, solution.
I'm sorry if my english is not perfect, I'm from Italy.

derek
Star Contributor
Star Contributor
Hi,
I have created a task for inclusion of your code: http://issues.alfresco.com/jira/browse/ALF-2262
As per http://wiki.alfresco.com/wiki/Source_Code, please fill in the form (http://www.alfresco.org/resource/AlfrescoContributionAgreementv2.pdf) and send it to me or fax to our offices in Maidenhead.  Sorry about the legal fuss, but we can't apply our license to your code without your consent!
Regards

EDIT: Contribution agreement received with thanks.

derek
Star Contributor
Star Contributor
The DWG contribution will be going into Apache Tika: https://issues.apache.org/jira/browse/TIKA-413

mwaychoff
Champ in-the-making
Champ in-the-making
the file system file properties for DWG files (in windows explorer read/writable on the [initial] 'Summary' tab) are not the ones we CAD users really want to manage. when using AutoCad we use the DWGPROPS command to populate a whole series of custom file properties for access outside the app (in windows explorer readonly on the now available 'Custom' tab).

the code mentioned on the TIKA page is related to a parser. isn't that for reading the ascii contents of a file? therefore wouldn't that be different than reading the file properties mentioned above? don't get me wrong parsing the DWG would be extremely useful as well just for perhaps very different purposes.

the vnd.dwg file on the TIKA page is not a valid AutoCad 2010 file. it also does not open in 2007 and can not be recovered either. perhaps a new example file should be provided.

pnacci
Champ in-the-making
Champ in-the-making
Hi, long time from last post, but I found a bug in DWG custom properties parser (TIKA) which is not present in my original code and propably affects all alfresco versions (3.x, 4.x community and enterprise).
I opened e new issue https://issues.alfresco.com/jira/browse/ALF-16628 about this bug and attached a working and non-working files.

If you need it, Derek, I can send working "C" code.

mwaychoff
Champ in-the-making
Champ in-the-making
also derek just a reminder that my last post is still a valid inquiry. i failed to mention there is also a command line autocad function PROPULATE as well (part of EXPRESStools) that is exposed to LISP programming. i can share screen cap.s next week if you are interested in the windows explorer dwg 'custom' properties tab i mentioned that i am interested in managing in alfresco.

pnacci
Champ in-the-making
Champ in-the-making
Bug resolved (in TIKA) see https://issues.alfresco.com/jira/browse/ALF-16628.

mwaychoff, I'm not sure to understand what you mean. Tika extracts standard and custom properties from dwg files. You can try using tika-app (1.3 latest to get rid of TIKA-1022 bug): you'll see standard and custom (named) properties extracted from dwg.

All you have to do to map DWG properties to Alfresco properties is to compile an xml file (see custom-metadata-extrators-context.xml.sample in tomcat/shared/classes/alfresco/extension) like this:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="extracter.DWG"   class="org.alfresco.repo.content.metadata.DWGMetadataExtracter" parent="baseMetadataExtracter">
        <property name="inheritDefaultMapping">
            <value>true</value>
        </property>
        <property name="mappingProperties">
            <props>
                <prop key="namespace.prefix.mycustomnamespace">http://www.sample.com/model/content/1.0</prop>
                <prop key="acadcustomprop1">mycustomnamespace:mycustomproperty</prop>
                <prop key="acadcustomprop2">cm:title</prop>
              </props>
        </property>
    </bean>
</beans>

where acadcustompropN is a named custom property defined in autocad, mycustomnamespace:mycustomproperty and cm:title are properties to be populated.