[Plugin] importDXFtext
-
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?
-
The original DXF import and the 'text' import options should match = e.g. centimeters, and the CAD origin must be preserved - so don't change the DXF import options after the DXF comes in, ad the last used options are used for the 'text'.
It's not you - when AutoCAD writes a DXF it uses Unicode characters for 'special' ones.
You have special characters like ° which are trapped for, but in your case things like Ę = E+ogonek [ \U+0118 ] with currently isn't expected, then these can cause weird crashes...I am looking at the code this weekend...
Another issue is the amount of Mtext - at ~1680 pieces the process of adding each group with the strings becomes progressively slower until it takes hours - 100 pieces whizzes through...
I'll look to see if I can split things into bite-sized chunks ! -
Here's v3.0
https://sketchucation.com/pluginstore?pln=importDXFtext
It's signed and updated for all latest SketchUp versions.
Some code has been streamlined and Unicode characters are now either 'translated' properly or skipped as u0123 etc rather than breaking Ruby...
Test and feedback... -
Well, the result are, little to say, interesting. At first glimpse it actually imported more text than the source file contained. I know, I know, this is not possible. Thing is, I saved DWG, then removed most of the text, then saved DXF. Looks like AutoCAD didn't really remove stuff from the file, just obscured it from view. I also have problems with scale but this can be my fault.
I need more time to test the new version carefully. Lotsa errands to run these days but I will let you know.
Thank you very much for the update! -
You must properly purge the CAD file before doing the DXF import, otherwise all kinds of things can come over unexpectedly. e.g. hiding a layer is not the same as actually deleting things that use that layer...
e.g. if you imported the original DXF as 'centimeters', then the imported text part of the DXF must use the same units.
The DXF import Options must preserve the CAD origin [for the two files], otherwise the text-part might be 'shunted' away from the originally imported geometry.
You can move everything back nearer to SKP origin afterwards...
-
I actually DID delete contents, not just hide layers. Though, it stayed hidden somewhere in the file! I'll do some googling about cleaning up CAD files.
-
Please report back with any useful discoveries...
-
Ignoring the CAD origin is the recommended option when importing general DXF files, otherwise - as you say - you can end up with geometry hundreds of miles from the origin !
The problem with ignoring the CAD origin importing a DXF that will have text associated with it is that the SketchUp CAD importer will put the entire imported geometry with the bottom-left-most part at the origin.
Then my DXF text importer reads the DXF file's data and places it at the original location - I have no way of deducing the offsets involved in the geometry versus the text.
So I recommend that you import using the CAD origin - you can always move everything back to the SKP origin afterwards...You could of course fix the offsetting in the CAD file itself, before making the DXF...
Then the issue is not so bad !
e.g.
https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-Core/files/GUID-4B4CBC73-3ADE-4769-86BD-8B81C8831E6B-htm.html -
I tried all possible variants for the import of text isolated from a plan (isolated, adjusted, older file formats, number of texts reduced to 3) and got in SUpPro2016 and SUpMake2017
a similar result: 2 nested groups with one guide point each.
Ruby Konsole:
DXF = '....\WenigTexteASCII.dxf'
UNITS = 'meters'
2 STYLES:
1 LAYERS:
37 TEXT ENTITIES:
0 MTEXT ENTITIES:
0 ATTRIBUTE TEXT ENTITIES:Making 37 TEXT Entities...
undefined local variable or methodbold' for TIG::ImportDXFtext:Module Error: #<NameError: undefined local variable or method
cp' for TIG::ImportDXFtext:Module>
C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:621:inblock in make_text' C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:511:in
each'
C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:511:ineach_with_index' C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:511:in
make_text'
C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1770:inimport' C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1795:in
new'
C:/Users/andreas/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1801:inblock in <module:ImportDXFtext>' SketchUp:1:in
call'
-
@einstein said:
I actually DID delete contents, not just hide layers. Though, it stayed hidden somewhere in the file! I'll do some googling about cleaning up CAD files.
I checked your "forum.dxf" and after cleaning it, it imported fine. Sample attached
Not sure if you have tried this already, but there are some dimensions "31046465 mm" away from your main drawing. We usually have general issues while importing geometry when the area to import is huge or when using Autocad "rays", after deleting these dimensions the text imported fine.
To find this kind of lost geometry you can just double click the scroll wheel on your mouse and it will zoom to extends. - As an option I believe the command is "zoom" + enter + "e" + enter again. For Autocad.
@tig said:
Please report back with any useful discoveries...
Great extension TIG, thanks!
Edited to make it clearer.
-
Thanks for the error report - which only affects the DXF's plain-Text, i.e. not Mtext etc...
It's fixed.
Get v3.1 here...
https://sketchucation.com/pluginstore?pln=importDXFtext
v3.1 Glitch with plain Text import [bold] fixed, cpoint deletion errors trapped.
Advertisement