[Plugin] FreeDXF Importer

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

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

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

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

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

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 
 

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

Postby honoluludesktop » Tue Jul 12, 2011 7:30 pm

I just accidentally discovered that you can drag and drop some dxf files into IE and it will open to view. Jim's reference file opens, but humpmetwice's doesn't. Is it a Acad created file?
0
User avatar
honoluludesktop 
In Remembrance
 

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

Postby Jim » Tue Jul 12, 2011 8:33 pm

honoluludesktop wrote:I just accidentally discovered that you can drag and drop some dxf files into IE and it will open to view. Jim's reference file opens, but humpmetwice's doesn't. Is it a Acad created file?


@HDT - Do you have AutoCAD installed, or a dxf/dwg viewer that enables the browser to display them using a add-on? (My guess.)


@Kurt - Thanks. This is what I get when importing your .dxf. It looks mostly OK, except the texts are not rotated (which I am aware but haven't fixed that yet.)

Untitled.png
0

Jim 
Global Moderator
 

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

Postby honoluludesktop » Tue Jul 12, 2011 8:40 pm

I have a old copy of volo, but it was a popup that prompted a activeX download to then open the dxf to view. Are they related?

Btw, Jim, do you know if the majority of the non text/dimension entities in your reference file are polylines?
0
User avatar
honoluludesktop 
In Remembrance
 

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

Postby Humpmetwice » Tue Jul 12, 2011 9:27 pm

Jim wrote:
@Kurt - Thanks. This is what I get when importing your .dxf. It looks mostly OK, except the texts are not rotated (which I am aware but haven't fixed that yet.)


Far more than what I get! I think I could work with that if you would tell me the secret to what I may be doing wrong. Is it the text we use?

Thanks Kurt
0
User avatar
Humpmetwice 
 

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

Postby driven » Tue Jul 12, 2011 10:58 pm

when I first import and use zoom extents I get this
frDXF_parsing_issue.png


then in SU, I deleted the \A1; text, I did 'select-all' to changed the font to momo 12pt, moved a couple of overlaps and in 'parallel projection' & 'top view'
I get this.
momo-12pt.png

the text is on Layer0
the model and dim lines are on the text layer,
and the dimensionline layer is empty

john
@Kurt hope you don't mind me testing your file, consistency helps debugging...
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 » Tue Jul 12, 2011 11:21 pm

@John - Select "No" for the Screen Text option to use 3D text (well, 3D in only 2D.)
0

Jim 
Global Moderator
 

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

Postby Jim » Tue Jul 12, 2011 11:23 pm

humpmetwice wrote:
Jim wrote:
@Kurt - Thanks. This is what I get when importing your .dxf. It looks mostly OK, except the texts are not rotated (which I am aware but haven't fixed that yet.)


Far more than what I get! I think I could work with that if you would tell me the secret to what I may be doing wrong. Is it the text we use?

Thanks Kurt



Just try the latest version. (This link is always the most recent.)
0

Jim 
Global Moderator
 

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

Postby Jim » Wed Jul 13, 2011 12:02 am

driven wrote:the text is on Layer0
the model and dim lines are on the text layer,
and the dimensionline layer is empty


Yes, this is similar to what I get when using SketchUp's Pro dxf importer.

(added text rotation, btw in latest. v0.6.1)
0

Jim 
Global Moderator
 

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

Postby thomthom » Mon Aug 22, 2011 10:19 am

I've been looking around at the various ruby based importers for SketchUp and I see that no one uses the Importer class. If this class is used the importer can be found in the native import list which would be very nice.
http://code.google.com/apis/sketchup/do ... orter.html
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 Dekker » Sat Nov 12, 2011 2:49 pm

It looks like the "inputbox.rb" plugin is no longer found in bitbucket :(

Any alternates available?

EDIT: Never mind... Found it! For the reference of others, the source is located here: http://forums.sketchucation.com/viewtopic.php?f=323&t=19103&p=347871&hilit=+inputbox.rb+#p347871
0

Dekker 
 

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

Postby Jim » Sat Nov 12, 2011 4:52 pm

Sorry 'bout that, Dekker. I am haphazard with my plugins - but I'm glad you found inputbox.rb

Any thoughts on the importer?
0

Jim 
Global Moderator
 

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

Postby thomthom » Tue Dec 20, 2011 3:04 pm

The link to inputbox.rb is dead.
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 » Tue Dec 20, 2011 3:17 pm

Does it handle materials in any way?
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 Jim » Wed Dec 21, 2011 10:46 pm

thomthom wrote:Does it handle materials in any way?


No. I don't remember seeing a "material" or "color" property for dxf entities. Isn't the color based on an entities' layer?
0

Jim 
Global Moderator
 

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

Postby TIG » Wed Dec 21, 2011 11:28 pm

You are right.
A DXF file gives objects layers, and those layers have colors.
If you take the SKP layers the colors export as random colors.
Even with similar SKPs newly made layers get unconnected colors.
It's possible to rationalize a DXF by post processing it's text - I have a commercial tool I've written which uses the native DXF exporter, but where the client wanted all DXF layers to be consistently colored; so it has a 'lookup table' and ensures consistency by 'stream-editing' the DXF's text after it's made.
Another way to have materials==colors is to export a custom made DXF but ignore the SKP's layers and using each material as if it were a DXF-layer... that way objects in the DXF are then grouped by each DXF 'layer' which is really made from the SKP's material-color rather than the proper SKP-layer...
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Not a Premium Member yet? Check out the great time-limited deal we are offering.

Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: AnttiV, dachaes, gonzo479, kennbarnes and 17 guests

Visit our sponsors: