[Plugin] importDXFtext
-
I haven't tried it.
Away from my PC now...
BUT it should just find 'nil' text-entities to process...Since it's a flaky DXF I suggest you find how to make a 'good' one containing the 'text'
-
Hi TIG.
I tried to get this plugin working on SU 2016 and wasn't successful. I go the following error in the console...
I was also importing DWG - is this an issue?
Error: #<ArgumentError: invalid byte sequence in UTF-8> /Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:123:in
strip!'
/Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:123:inblock in get_styles' /Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:121:in
upto'
/Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:121:inget_styles' /Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:1721:in
run_tool'
/Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:1729:inimportDXFtext' /Users/tk/Library/Application Support/SketchUp 2016/SketchUp/Plugins/importDXFtext.rb:1737:in
block in <top (required)>'
SketchUp:1:incall'
-
A DWG [or a DWF] file is NOT a DXF !
The former is in a proprietary 'binary' coding, the latter is in readable 'text'.
This script reads the 'text' [DXF], finds various 'TEXT' entries etc, and uses that data to recreate the SKP's equivalent 'flat' 3d-TEXT objects.It will never work with another file type.
So export your DWG as a DXF... and try again...
-
Ah, understood. My apologies.
-
Is it compatible with SketchUp 2016?
Thanks -
It should install and work in v2016 OK.
Although it's RBZ is not yet signed for v2016, it should load OK in the default security mode - 'Unrestricted'...Please be aware of its usage / limitations - see its first post.
nor non-ASCII DXF[x] files.
If you want to import the DXF's Geometry, and then the overlaid Text from within it, then you should ensure that the DXF import options are the same both times, AND that the CAD origin is set to be preserved - this ensures that the geometry and text overlay properly - you can always select, then move the two imported components neared to the Model's origin afterwards, if needs be.
Obviously the DXF must contain some Mtext, Dtext objects etc ! -
I've been getting an error that breaks your plugin for some files, TIG.
It appears that my file had text that was not encoded in UTF-8. I added a line to your code to get it working.
txt.strip! if txt txt.chomp! if txt txt = txt.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8') # added this line
-
HI Tig,
Thanks for creating this plugin.I've followed, i hope, all the instructions on importing but most of the text is not showing up - the ruby console, in my humble knowledge (first time of using the console) shows some promising info that there is text information in the .dxf file - see attachment.
the regular import brought in all the relevant geometry, i also have a .pdf of the .dwg file (that this .dxf file was made from) which shows there is text information.
I do get a small amount of text that shows up.(see image)
I've imported in 'mm' which is correct - they've just emailed to confirmI was wondering, as it looks like there's info coming in, that I've done something wrong -
I've unhidden everything
I've checked all layers are visible too ......mmmmm
is there anything else i need to try?I've sent you the .dxf file - it will be PM'ed on finishing this.....
cheers
Chris
-
You first import the DXF keeping the CAD origin in the import options.
This must be kept to maintain the correct location of the text in later steps.
Set the units to be whatever the DXF was saved in...
If you are not sure then mm is probably the safest ?Now run the DXF-text importer, using the same units etc...
It can take a loooong time to import a lot of text from a DXF.
I tested your DXF and got an error after it processed the text, and then placed the first piece temporarily at the origin.
I suspect it's an issue with the way the newer Ruby methods in v2017 processes some objects.This is an old clunky script, so I'll look at a fix asap...
-
Thanks tig that's amazing.
Yes I followed your 1st post instructions. Origin etc all the same.
Thanks for looking into it!
-
I have now updated it and will be adding it to the PluginStore shortly...
I fixed the glitch with the new Ruby methods and also updated it somewhat, so it now runs slightly differently and is much faster [although < 1 second per text element added can still seem a long time!], and it also now reports its progress better etc...
I'll post here when it's ready.I could also PM you your updated SKP back - 28Mb ! ...
But it could be slimmed down considerably, so it'd process quicker and give cleaner results.
For example some of the blocks of disclaimer text are constrained in CAD by using a boundary rather than newline carriage-returns, so when they import they are one long string rather than say 6 lines of text.
Either edit this kind of Mtext in CAD before making the DXF, or delete it completely as I can't see what use it is in the SKP anyway.
So perhaps fix issues with the DXF's text first and then process it yourself once v2.0 is posted ?PS: Trimble's signing portal is down at the moment so I can't complete the update...
Watch this space... -
Tig! your're amazing!
Thanks for the advise on the Autocad and how to slim it down. I didn't create the original - i don't own any autocad software, I think Draftsight wafted past my computer a few months ago, but i have no way of altering the initial file. It was given to me as a Favour from the Studios, I won't on this occasion ask to change it, as i know I'll only bug them. I'll see them face to face tomorrow so i will ask then. but what you've done far exceeds expectation!! Amazing job cheers
c -
Here's v2.0 http://sketchucation.com/pluginstore?pln=importDXFtext
It is now compatible with newer SketchUp's Ruby versions.
It is also now made as a signed extension.
Read the 'More Info...' link for all of the changes... -
it worked! ..... but it did'nt line up with the geometry. there was a 3 at the origin.
i have now eyeballed it refering to my pdf's and its good enough for tomorrow. I will investigate further when i have more time tomorrow and get back to you with results. imported units were the same with text and geometry....ps it might be worth highlighting you have to put in exactly - TIG::ImportDXFtext.new - to those unfamilar with the ways of the consol. A couple of trys and i was there but I'd not put a capital I for Import. ooh its so picky .....
Great work non-the-less!!!!
c -
I recommend you use the File menu option and keep the Console closed.
It will run faster... -
Should it work with SU 2020?
Because it doesn't work for me. I saved from AutoCAD as old version of DXF as possible (2000/LT2000 DXF) and imported the file into SketchUp. All relevant layer were ON.
SketchUp only imported an empty layer on which I had my dimensions but did not import a layer on which I had text. In statistics it shows no entities.
CTRL+A results in empty selection. Also there is nothing to unhide.Could you please take a look at the DXF, maybe try to import it and help me track the issue?
I have no other version of SketchUp to try.
-
There are 1683 text-entities in the DXF !
Did you check that the geometry [and text import afterwards] of the DXF preserved the origin in the Import Options settings...
Did you use the same units settings.
Did you run it with the Ruby Console open ?I do get an error message - I'm checking it out - I suspect it's the way that newer SketchUp handles references to deleted [non-existent] objects !
-
I now removed most of the text before saving to DXF, to do a little, easy test-drive.
Console closed.
I used the same units - first saved DWG in AutoCAD in millimetres, then saved DXF, then imported to SketchUp as millimetres.
Still no success.
Where are the import options settings? Do you mean regular DXF import? -
The reused Import Options for the DXF text must be the same as the main DXF's Import Options, and preserve the CAD-origin.
Many of your text strings contain special Unicode encoding.
Many are trapped already like Β°, but some are sneaking through.
Unexpectedly trying to add those as 3Dtext into the model causes everything to fail very catastrophically!
I'm looking at ways to trap for this... so far unsuccessfully...I'll be back...
-
Well, I didn't do any kind of sorcery over that text It is simply AutoCAD text and dimensions.
I would be very thankful if you could resolve it but don't bother if you don't have time.If I only import text, without any other stuff, is it still relevant that DXF native and your import options must match?
Advertisement