[Plugin] importDXFtext

[Plugin] importDXFtext

Postby TIG » Sun Oct 25, 2009 12:50 pm

Now you can import 'flat' DXF text to match your imported DXF geometry...

(c) TIG 2009-2017

importDXFtext.rb

It is an Extension [>=v2.0] - so ensure it's activated...

Run the tool by typing in the Ruby Console:

TIG::ImportDXFtext.new

or [ the best as the Console being open slows it down...]

Menu > File > Importdxftext...


Select the DXF file [text-type] from the first dialog.

Select the DXF's Units in next dialog.

Progress is reported in the Ruby Console OR the status-bar.
It takes about a second per text element - so edit the DXF to minimize what's imported, no need to import what you don't want !

It then imports any Text/Mtext/AttributeText in the DXF file.

It makes it as groups of '3Dtext'.

It uses the DXF's Styles data to set the:

Font, Height, Color, etc

It uses the Text/Mtext/AttributeText data to set the:

TextString, LocationXYZ, Rotation, Height, Justification, StyleData, Layer etc

Mtext might also have additional internal formatting [like a boundary causing wrapping in CAD], but only carriage-returns are read [\P == \n]

Other formatting is ignored and the base Style is used... e.g.

\Hnx for x height for some text
\Hn for set height for some text
|b0| for Bold to some text
|i0| for Italic to some text
|c0| for Color to some text

etc are all ignored.

Text/Mtext/AttributeText inside a Block/Insert is also imported.

The Text/Mtext/AttributeText Layers are preserved.

The Text/Mtext/AttributeText Color is set from the Layer Color or its Color if set otherwise - note that only the base 255 standard ACI colors are used - the first 9 by name the rest by ACI-code: and any others [e.g. pantone_colors] revert to 'Black'.

Any DXF Font that's not available on your Computer defaults to 'Arial'.

Note that only the Text/Mtext/AttributeText Entities are imported and that all other Geometry etc must be imported in the 'conventional' manner, separately...

It's recommended that where separately imported DXF Text is to be 'matched' that when Importing the DXF's Geometry the Option is set to 'Preserve Drawing's Origin' [not usually recommended for extreme origin offsets] - otherwise the Imported Text [that must use that Origin] will probably be displaced, and perhaps awkward to relocate properly!

Note that it can take a while to process complex Mtext strings...
so be patient...

v1.1 20091028 Menu added. Glitch with 'empty' strings fixed.
v1.2 20091029 Further glitches with 'empty groups' trapped:
any 'empty' strings marked with cpoint:
text-group/s does not now cast/receive shadows:
progress shows on VCB as well as Console.
v1.3 20131212 Future-proofed.
v2.0 20170419 Updated to newer SketchUp/Ruby compatibility etc...

Download

0
Last edited by TIG on Thu Oct 29, 2009 11:02 am, edited 2 times in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext

Postby CadFather » Mon Oct 26, 2009 5:36 pm

Thanks TIG, if it works is one of those musts
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] importDXFtext

Postby TIG » Mon Oct 26, 2009 11:25 pm

CadFather wrote:Thanks TIG, if it works is one of those musts

if it works ! Of course it works ! Of course it could be improved.... but this is its first release ! ;)

Comments and feed back please... So far 27 down-loaders - 1 comment ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext

Postby CadFather » Tue Oct 27, 2009 9:13 am

:)

TIG i think a menu would be a nice addition.. ..might make testing simpler


first try:
Code: Select all
Making 0 TEXT Entities...
Making 144 MTEXT Entities...
Error: #<TypeError: C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:909:in `bounds': reference to deleted DrawingElement>
C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:909
true


must be something i missed
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] importDXFtext

Postby Mike Lucey » Tue Oct 27, 2009 10:58 am

Thanks TIG,

I haven't had a need to import DXF text of late but have have (a lot) in the past, so this will be bloody useful and a big time saver when I need it again :thumb:

I have no doubts that it will work perfectly ;)

Mike
0
User avatar
Mike Lucey 
Mayor
 

Re: [Plugin] importDXFtext

Postby TIG » Tue Oct 27, 2009 11:40 am

CadFather wrote::)

TIG i think a menu would be a nice addition.. ..might make testing simpler


first try:
Code: Select all
Making 0 TEXT Entities...
Making 144 MTEXT Entities...
Error: #<TypeError: C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:909:in `bounds': reference to deleted DrawingElement>
C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:909
true


must be something i missed

The next version will have a menu item.
The error you report seems to be caused by having a piece of Mtext that's only a <space> and no actual characters to make into a group - I'll trap for that so the error is ignored - watch out for an update later today...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext

Postby Panga » Tue Oct 27, 2009 1:05 pm

Thanks a lot for this one...long time wanted !!
0

Panga 
Premium Member
Premium Member
 

Re: [Plugin] importDXFtext v1.1

Postby TIG » Wed Oct 28, 2009 10:50 am

Here's v1.1 that has a menu item and the empty string glitch fixed...
viewtopic.php?p=194488#p194488
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.1

Postby CadFather » Wed Oct 28, 2009 5:37 pm

Thanks TIG - i get this error.. but i will try other files as well

Code: Select all
Error: #<TypeError: C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:923:in `bounds': reference to deleted DrawingElement>
C:/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb:923
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] importDXFtext v1.1

Postby TIG » Wed Oct 28, 2009 6:04 pm

I reproduced the error occur by having a piece of Mtext with only a space or carriage-return in it. That's trapped - must be something similar although I thought I'd trapped all calls for bounds etc if the group wasn't valid? Please see if you can find what's causing the problem and report back - it can't be that hard to trap for if we know what it is ! :idea:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Thu Oct 29, 2009 11:06 am

Here's v1.2 viewtopic.php?p=194488#p194488

It should stop some of those errors - please try and feed back...
Empty strings are now show with a Cpoint, the grouped text does not cast or receive shadows and the VCB now shows progress as well as the Console if preferred...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby Redsteel » Sun Feb 20, 2011 11:36 pm

Thank you very much for this, for once i was getting really pissed with SU but your work it's a life saver, thanks again.

...btw, is there a menu version? :D
0

Redsteel 
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Wed Mar 23, 2011 10:56 pm

i tried to import a dxf and SU is crashing. It is not a big file.
you can check it out: http://dl.transfer.ro/transfer_ro-23mar ... f2cc8f.zip (it expires in 10 days)
0
Last edited by alexdobras on Thu Mar 24, 2011 1:23 am, edited 1 time in total.

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Wed Mar 23, 2011 11:57 pm

Alex
You didn't specify the DXF's units...
I downloaded your file anyway
I got a Bugsplat importing it using 'mm'!
Importing it using 'm' I did get some rapid output in the Ruby Console... then an error after some importing...
This is everything imported
Capture.PNG
This is an extract of a part of it
Capture1.PNG

The Ruby Console output failed on a layer name 'T' not being defined.
That layer name is used for Lines, but as far as I can see not for 'Text' ?
BUT then there are almost 150,000 lines of code in the DXF file [it's 'NOT BIG' :shock: ] !
The DXF won't load into AutoCAD at all !!! ... so I suspect it is corrupt in some way ??
The error is "Unknown value "AC1024" encountered in drawing version" - I only have ACAD2008 so perhaps it's made in an NEWER version? DWG convert might work if it were a DWG file... BUT it's a DXF file :?
I also made a layer named 'T' before trying 'meters' for the import units and got this result - after a looooong wait - with no errors...
Capture2.PNG
detail
Capture3.PNG
I can't believe you want ALL of this text importing - try to reduce the content of the DWG>>DXF and save in an older version like r2004, as it will import cleaner and quicker... :roll:

Could you edit the CAD file so it only contains 'text' and retry...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Thu Mar 24, 2011 12:49 pm

yeah, for some reason the file cannot import into Acad. I had a dwg, which i saved into dxf in order to work with the file in SU and Blender. Now, Blender 2.49 imports the file perfectly, i mean flawlessly with text and everything like i see it on CAD software i use: DraftSight. When i open the file in SU, the same file as in Blender, the model comes with a lot of deformations and with the text missing- I mean through SU 8 PRO native dwg/dxf importer that comes with the pro version. No matter is dwg or dxf the file will import bad.
So i am using this plugin in viewtopic.php?f=323&t=31186&start=75, which actually doesn't deform the model, but takes more time to import the file. The only problem is it doesn't import the text, and the model need to have everything exploded, so no blocks.
I hope you did understand about what i am talking about
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Thu Mar 24, 2011 3:08 pm

Sketchup doesn't import dwf/dxf text that's why I wrote the script...
It is a good idea to reduce the dxf down to just the text items- it speeds the import and aaoids errors. It's easy to make a copy of the file in your CAD app and then filter to leave just the dtext/mtext etc, then purge and audit the dwg, then finally save as a ~r2004 DXF...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Thu Mar 24, 2011 8:00 pm

TIG wrote:Sketchup doesn't import dwf/dxf text that's why I wrote the script...
It is a good idea to reduce the dxf down to just the text items- it speeds the import and aaoids errors. It's easy to make a copy of the file in your CAD app and then filter to leave just the dtext/mtext etc, then purge and audit the dwg, then finally save as a ~r2004 DXF...


i have done what you said, and still SU crashes right before imports the text :|

TESTTEXT2004.dxf


btw, i have intel i5 750, 2gb ddram3, video Geforce GTS250, win7 64 bit, and SU8
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Fri Mar 25, 2011 12:18 am

You have NOT trimmed down the file to include just 'Text' !!
You have simply switched other layers 'off' - these are still there and so Sketchup WILL try to import them !!!
Here's a properly reduced version of the DXF...
TESTTEXT2004.dxf
And the resultant SKP.
TESTTEXT2004.skp
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Fri Mar 25, 2011 12:34 am

TIG wrote:You have NOT trimmed down the file to include just 'Text' !!
You have simply switched other layers 'off' - these are still there and so Sketchup WILL try to import them !!!
Here's a properly reduced version of the DXF...


i tryed what you have sent me
still, it crashes
now see for yourself:click on Télécharger ce fichier
http://dl.free.fr/getfile.pl?file=/r36AYYVu
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Fri Mar 25, 2011 12:37 am

BUT you tried to import it in 'mm'... I did it in 'm' - as I explained before.......
I worked fine for me...
WHAT are the units you are working in ... :shock:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Fri Mar 25, 2011 12:45 am

TIG wrote:BUT you tried to import it in 'mm'... I did it in 'm' - as I explained before.......
I worked fine for me...
WHAT are the units you are working in ... :shock:


sorry TIG, i knew i forgot to change something.
when putting to m , it works,
but i don't understand why is crashing at mm, though.
and a second one, why the file needs to be saved as 2004 ascii dxf, could;nt you make it up-to-date to ascii 2010 drawing?

thanks anyways for this wonderful plugin!
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Fri Mar 25, 2011 1:03 am

alexdobras wrote:
TIG wrote:BUT you tried to import it in 'mm'... I did it in 'm' - as I explained before.......
I worked fine for me...
WHAT are the units you are working in ... :shock:


sorry TIG, i knew i forgot to change something.
when putting to m , it works,
but i don't understand why is crashing at mm, though.
and a second one, why the file needs to be saved as 2004 ascii dxf, could;nt you make it up-to-date to ascii 2010 drawing?
Thanks anyways for this wonderful plugin!


Presumably at 'mm' the size of some objects is just too small of Sketchup/OpenGL <~0.5mm - You OUGHT to import all of your DXFs etc in at their correct unit settings - I assumed 'm' as it simply 'worked' and you [still] gave me no clue - CAD files have no real UNITS - the recipient must be told that vital info so the units can be 'set' on import !??
Please remember that this is a ***ing 'free tool' :roll: I wrote it to read DXF format files as they were made at that time - so your saving it in a more recent DXF format gives YOU absolutely NO benefits and me only a headache...
Reading the code in a DXF file is complex enough to 'parse' - even in its 'text' format - I suggest you open a DXF file in Notepad to see what I mean... A binary format like DWG is a zillion times more involved [open one in Notepad to see the gobbledygook]... So... IF YOU want to write your own DXF importer and share it freely with the rest of us, then please feel free :cry:
Gift horse...mouth... etc :x
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Fri Mar 25, 2011 1:22 am

"you [still] gave me no clue" - i don't exactly understand what are you saying.
Perhaps my English is not as good as should be.
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Fri Mar 25, 2011 2:16 am

good news, mate:
i created another dxf with text and saved as Ascii 2010 drawing dxf
and guess what ? it has imported almost perfectly, if the cyan letters weren't reshaped:

here's the file:
text2010.dxf

here's the preview in CAD:
1.PNG

here's the peview in SU:
2.PNG


seems when importing into SU, it is not recognized the shape of the cyan text :|

the same exact thing happens with a 2004 dxf ,with the cyan text
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Fri Mar 25, 2011 11:20 am

Alex...
When you give a DXF [or DWG] to someone you need to tell them what units it was made with.
Sketchup always uses inches as its base units - the displayed units are simply to help users who work in say 'cm'...
CAD programs typically just work in an arbitrary 'unit'.
When you are working in the file you assume that say 1 unit = 1 cm.
When you give that CAD file to someone else unless you tell them the assumed units that were used they have no way of knowing what 1 unit of the CAD file is in the SKP... SO if a line is i unit long how do I know you meant it to be 1m or 1mm, or whatever...

On the issue of the 'incorrect font'.
The DXF importer uses a list of typical fonts found on most PCs and MACs.
A text-font that is not available as a 'tt' font on your system reverts to 'Arial' as here with the 'cyan' text.
Your DXF only includes ONE STYLE
    0
    STYLE
    5
    11
    330
    3
    100
    AcDbSymbolTableRecord
    100
    AcDbTextStyleTableRecord
    2
    Standard
    70
    0
    40
    0.0
    41
    1.0
    50
    0.0
    71
    0
    42
    2.5
    3
    txt
    4

    0
    ENDTAB
which is named 'Standard' [#2] and uses a font-file called 'txt' [#3] - and there is no 'named' tt-font [no #1000]. It's set at 0.0 high [#40] so the user can specify the text height. It's width-factor is 1.0 [#41]. It's obliqueness is 0.0 [#50]. It is not flipped [#71]. It has no set color [no #62]...
The cyan colored TEXT that says 'traa aaskjaksdfasdfa' is set in the DXF as follows...
No STYLE set [no #7] - reverts to the default style of 'Standard'...
Layer = '0' [#8]
Thickness = 50 [#39] WHY ???
Oblique = 30 [#51] WHY ???
Color = '4' [#62]
Flipped = 6 [#71] WHY ???
Rotated = 10 [#50] WHY ???
If any TEXT has it's values set weirdly like this it will revert to some defaults to at least import something !
Please use this tool as it is intended... Sketchup importers will only bring in raw geometry and ignore text etc. I made this tool to bring in text from a DXF... BUT there are limits - it did bring in all of the text even if some of it had been cruelly 'mangled' by you before hand :roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby alexdobras » Fri Mar 25, 2011 3:44 pm

thanks TIG for the complete description.
i just wanted to dream about how cool it would have been if the text was completely imported with all the characteristics. but never the less,at least everything is imported and even has color.
so, thanks a tonne for making this possible, TIG, you rock!
0

alexdobras 
 

Re: [Plugin] importDXFtext v1.2

Postby Wakanai77 » Sat Sep 21, 2013 12:30 pm

This worked for me and saved alot of time!

thank you very much
0

Wakanai77 
 

Re: [Plugin] importDXFtext v1.2

Postby Miner_Jeff » Wed Nov 11, 2015 8:53 pm

Hello,

I realize this is a an old thread. Anyone else having issues trying to use this with Sketchup make 2015?
I get a crash shortly after invoking the script in the console, goes straight to bugsplat reporting.

Thanks Tig for all your selflessness in sharing of your ruby programming skills.

Cheers,

Miner_jeff
0
User avatar
Miner_Jeff 
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Wed Nov 11, 2015 9:07 pm

Can you shared the text's DXF with me ?
You can PM it to me if needed.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] importDXFtext v1.2

Postby TIG » Wed Nov 11, 2015 9:51 pm

Having looked at the DXF you PM'd to me...
I confirm that it contains NO TEXT/MTEXT entities, unlike a normal CAD-originated DXF might.
There seems to very little I might call 'text' ["...FILM..."], and there are many empty objects that look like they might have been intended to be text...

I suspect that everything is in CAD 'lines' or 'polylines', and that no CAD 'text' is included in it - perhaps because of the preprocessing app you've used ?
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: adrmike, alfredolopez, engrarslankhan, genomdisorder, Pho Lam and 7 guests

Visit our sponsors: