[Plugin] FreeDXF Importer

[Plugin] FreeDXF Importer

Postby Jim » Wed Sep 23, 2009 7:56 pm

FreeDXF is a SketchUp plugin to import ASCII .dxf files.

Latest version is 0.10.2 and is available in the Plugins Store

Download

0
Hi

Jim 
Global Moderator
 

Re: dxf importer developer version

Postby remus » Wed Sep 23, 2009 9:13 pm

Good idea im. I can see a lot of demand for this when 8 comes out.
0

remus 
 

Re: dxf importer developer version

Postby pilou » Sun Oct 18, 2009 10:58 am

Is not an hard work for an aging format?
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: dxf importer developer version

Postby thomthom » Sun Oct 18, 2009 12:28 pm

Ageing format, but still in use. Just look at the .3ds format - blasted thing is still around.


Nice list of specs you found there Jim. Are you writing against the 2010 version?
1
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: dxf importer developer version

Postby Gruff » Mon Oct 19, 2009 9:14 am

thomthom wrote:Nice list of specs you found there Jim. Are you writing against the 2010 version?


I'd recommend writing it to the earliest version of DXF that is still supported under 2010.
One heck of a lot of users are still using 2006 and earlier.

~Gruff
0
Resistance is .... Character Forming. *Grin*

Gruff 
 

Re: dxf importer developer version

Postby toxicvoxel » Mon Oct 19, 2009 9:21 am

Jim,
Which DXF entity types do you aim to support eventually?
0

toxicvoxel 
 

Re: dxf importer developer version

Postby thomthom » Mon Oct 19, 2009 9:23 am

Gruff wrote:
thomthom wrote:Nice list of specs you found there Jim. Are you writing against the 2010 version?


I'd recommend writing it to the earliest version of DXF that is still supported under 2010.
One heck of a lot of users are still using 2006 and earlier.

~Gruff

hm... I could see the logic of that if you where writing DXF format. But we're talking about reading DXF format. I'd think that you'd want to be able to read recent formats.
Is the DXF format constructed in such a way that parsing a DXF file with the newest spec will allow it to read older versions?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: dxf importer developer version

Postby toxicvoxel » Mon Oct 19, 2009 9:35 am

I haven't used a new version of AutoCAD for some time but historically solid objects where defined as encoded strings within the DXF export file, rendering it only partially 'open'. Not sure if this situation has changed but it may be a challenge to support all current AutoCAD entity types.

Has anybody explored the cost of using the libraries from the Open Design Alliance?
(http://www.opendesign.com/)
0

toxicvoxel 
 

Re: dxf importer developer version

Postby Jim » Mon Oct 19, 2009 2:16 pm

toxicvoxel wrote:Jim,
Which DXF entity types do you aim to support eventually?


Right now, it has calls to handle: LINE ARC CIRCLE VERTEX SEQEND ELLIPSE BLOCK ENDBLK INSERT POLYLINE 3DFACE

Although some do not work properly. You may have noticed it creates an output file named freedxf_types.txt in your plugins folder. It is a breakdown of found and supported command blocks for the imported file for inspection, one per line.

Nice list of specs you found there Jim. Are you writing against the 2010 version?


I didn't look at all the version - I don't know what the difference is between them. I arbitrarily opened the 2000 version because it had online html and started coding. I don't think the format will have changed - i.e. the parser should be forward compatible. What may change is how each entity type is handled, or new types introduced. I'm probably wrong.

I'm not sure how useful it will be in the end. I hosted in on bitbucket to encourage hacking on it. If mercurial/bitbucket isn't your thing, I can do a git/github repo also.
0
Hi

Jim 
Global Moderator
 

Re: dxf importer developer version

Postby TIG » Mon Oct 19, 2009 2:40 pm

In passing... I am working on a parallel DXF TEXT importer that imports any text/mtext/attributes in the DXF - as flat 3D text using the size, font, formating etc...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: dxf importer developer version

Postby toxicvoxel » Mon Oct 19, 2009 3:53 pm

Jim,
I think it would be imperative to support polyface meshes as minimal functionality for this plugin as so many formats export faces using this structure.
This would also potentially provide a logical optional construct to map against sketchup groups, which maps to blocks in the current importer/exporter.

Your efforts are appreciated.
0

toxicvoxel 
 

Re: dxf importer developer version

Postby Gruff » Thu Oct 22, 2009 10:00 pm

thomthom wrote:hm... I could see the logic of that if you where writing DXF format. But we're talking about reading DXF format. I'd think that you'd want to be able to read recent formats.
Is the DXF format constructed in such a way that parsing a DXF file with the newest spec will allow it to read older versions?


No. Quite the reverse.

If we are only talking 2D/3D wireframe standard elements then I do not think it would be a problem. Getting into 3D Surfaces and Solids could very well be a version issue.

AutoCad typically allows you to save a DXF (or DWG) to 3 or 4 earlier versions of the file format.

If Jim's importer can only read 2010 DXF and I only have ACAD version 2004 then Jim's importer may be expecting data structures that simply do not exist in the 2004 version. I would not be able to use his utility.

If Jim writes his importer to read 2004 DXF files then someone with version 2010 of ACAD can always save his file to the older version for Jim's program.

Of course the smartest move would be to have his program read the version and use the appropriate version translator. But that is a tall order I think.
0
Resistance is .... Character Forming. *Grin*

Gruff 
 

Re: dxf importer developer version

Postby thomthom » Thu Oct 22, 2009 10:10 pm

Gruff wrote:If Jim's importer can only read 2010 DXF and I only have ACAD version 2004 then Jim's importer may be expecting data structures that simply do not exist in the 2004 version. I would not be able to use his utility.

You say "may"... Have you studied the format? Or is it a guess?

I was thinking that it'd build upon the previous versions. That a 2010 reader would be able to read previous versions. Why would you extend a format such that it changes an existing implementation? That just seem to create more problems.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: dxf importer developer version

Postby Gruff » Sun Oct 25, 2009 6:48 pm

thomthom wrote:
Gruff wrote:Have you studied the format? Or is it a guess?


I have written translators for several CAD file formats and a few simple converters for DXF. Most recently a DXF exporter for Solidworks to SigmaNest. (Creating additional geometry not in SW on export)

It is the nature of file formats to evolve to support more features and to crop structures that are no longer necessary for the latest version. If I recall correctly AutoCAD version 1.0 came out in 1982.
DXF was defined sometime thereafter... 1984 or so. Quarter of a century would be a long time to remain backward compatible for a privately held file format. ;)

As I said earlier though. If all Jim is going to support is wireframe then it shouldn't be an issue.
0
Resistance is .... Character Forming. *Grin*

Gruff 
 

Re: dxf importer developer version

Postby honoluludesktop » Tue Oct 27, 2009 9:07 pm

Hi Jim, Am watching this topic for your progress. Btw, I see that you bookmarked the html for Dxf definitions. I did the same thing until I realized "Dah!", that I could bookmark the pdf on line as well. Sigh, old habits die hard:-(
0
User avatar
honoluludesktop 
In Remembrance
 

Re: [Plugin] Free DXF importer (2011-07-02, alpha)

Postby Jim » Sun Jul 03, 2011 3:49 am

New Version 0.51

* Improved ELLIPSE method
* Added import of TEXT entities.

See first post for download.

1859.png
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF importer (v 0.51 2011-07-02, alpha)

Postby driven » Sun Jul 03, 2011 1:13 pm

hi Jim,

should it work on mac?

trying to load your .dxf gives
Code: Select all
Error: #<TypeError: reference to deleted Group>
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:466:in `transform!'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:466:in `draw_text'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:133:in `draw'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:92:in `main'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:91:in `each'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:91:in `main'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:503
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:466:in `call'
/Library/Application Support/Google SketchUp 8/SketchUp/Plugins/freedxf/freedxf.rb:466

haven't time to look further at the moment, so thought I'd ask first.
john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF importer (v 0.51 2011-07-02, alpha)

Postby Jim » Sun Jul 03, 2011 7:19 pm

Thanks, John. I started seeing that error too, although not everytime. It's really baffling because it appears to have started when I made some changes in what should be an unrelated method. I will trap the error, but I am still not sure what exactly is happening. There will be an update (or 2) today.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby thomthom » Thu Jul 07, 2011 2:38 pm

Does bitbucket reflect the latest changes?

I went looking at it to work out what it imported DXF TEXT entities as. Text entity in SketchUp?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby thomthom » Thu Jul 07, 2011 2:47 pm

Ok - tried it out. I see the text comes in as simple geometry. Would be useful with an option to get the text as native Text elements. And/or when the text is imported as geometry, add the text value to an attribute so it can be read by other Ruby scripts.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby thomthom » Thu Jul 07, 2011 2:56 pm

Does it handle units at all? Or does it assume inches?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby TIG » Thu Jul 07, 2011 3:20 pm

My importDXFtext.rb ideas could be cannibalized into this tool to add the DXF's text in 2d 3dText groups, using available fonts or defaulting [mine uses Arial.ttf if the font is not in one that's listed] - my tool also replicates the [M/D]text/attribute's coded-symbols, colors, size etc wherever possible - also you could easily add an attribute for the text's 'string'... :)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby thomthom » Thu Jul 07, 2011 4:01 pm

I managed to hack this plugin for my need. Placed Text objects. Then I could use them to extract their insertion points and move them to the height given in the text - resulting in a point cloud, which I used TIG's Triangualte Points (modification of Didier) to generate a terrain mesh.

*phew*

At least now I got an accurate terrain. Thanks for all your scripts. :thumb:
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby TIG » Thu Jul 07, 2011 4:09 pm

Ages ago I wrote an AutoLisp tool to run in your CAD DWG and read 'flat' spot-height pieces of D/Mtext and move them in the Z to suit their given 'elevation' taken from the text's string into a float, and also add a 'point' at the text's origin - you can then export those as a point-cloud DXF for use in your SKP... to meshify it...
If the lisp would be of any help let me know and I can PM it...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby Jim » Thu Jul 07, 2011 10:36 pm

thomthom wrote:I went looking at it to work out what it imported DXF TEXT entities as. Text entity in SketchUp?


Currently TEXT and MTEXT are imported as 3D text (but with zero thickness.) The Font defaults to low-quality Arial. Texts respect newlines, position, height, font (if installed?), bold, and italic styles. Roation is not yet complete. Tects color is always black for now.

I had planned an option to import text as SketchUp screen text. In fact that's the easiest way to import it and the most economical as far as geometry.

thomthom wrote:And/or when the text is imported as geometry, add the text value to an attribute so it can be read by other Ruby scripts.


Good idea - will implement.

thomthom wrote:Does it handle units at all? Or does it assume inches?


FreeDXF does not consider units at the moment, so every import would be considered as being in Inches.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby driven » Mon Jul 11, 2011 3:07 am

hi Jim, here's a mac screenshot,

I've got an archive of these simple reduction gear dxf's and it opens them a threat...

it's particularly useful being able to specify circle and arc segment counts, the v7 SU importer bought these in a such low quality, I couldn't use them.

it splits out into layers, but doesn't group those items, I haven't read the script yet but is that addable?

i.e. each layers geometry is also a group so it doesn't stick on first opening with all layers on.

also does it do faces?, I'm not sure if this test file has any... a lot of them don't.

cheers

john
0
learn from the mistakes of others, you may not live long enough to make them all yourself...

driven 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby Jim » Mon Jul 11, 2011 10:52 pm

driven wrote:it splits out into layers, but doesn't group those items, I haven't read the script yet but is that addable? i.e. each layer's geometry is also a group so it doesn't stick on first opening with all layers on.


Yes, I think it's addable. I was using SketchUp Pro's dxf importer as my example; which does not group geometry by layer. But it seems like a better way to import geometry seeing as cad layers are more like SketchUp Groups than SketchUp Layers. So would all entities in the group be on the cad layer, or just the group on the cad layer with the raw geom on Layer0?

driven wrote:also does it do faces?, I'm not sure if this test file has any... a lot of them don't.


Not really yet. It does import 3DFACE entities, but I think they are not common in dxf's.

I appreciate the feedback. (send test files.)
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby Humpmetwice » Tue Jul 12, 2011 2:31 am

By reading everything I'm not sure if I'm doing something wrong or its not able to import text yet? It would really be a helpful tool if it did!

Thanks Kurt
0
User avatar
Humpmetwice 
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby Jim » Tue Jul 12, 2011 8:22 am

Thanks Kurt. It should import text and mtext entities. I would be interested in testing your .dxf file, if possible.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer 2011-07-04

Postby Humpmetwice » Tue Jul 12, 2011 6:31 pm

Jim wrote:Thanks Kurt. It should import text and mtext entities. I would be interested in testing your .dxf file, if possible.


Hope this helps, I think its just the type of text we used but I'm not sure. I was thinking it was standard MTEXT but may have been wrong?
0
User avatar
Humpmetwice 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: astrido, ChiefMonkey, Darckrim, sdmitch and 8 guests

Visit our sponsors: