[Plugin] importDXFtext
-
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?
-
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
Advertisement