[Plugin] importDXFtext
-
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. -
It works now. Thank you TIG.
-
I do not know why , but when I try to import mtext ... rotation parameter it is not correct as it's always 0 degree . Probably you can help me to understand where I am mistaken
-
This script does its best to interpret a DXF file's text and add a similar group of 2d-3dtext into the model.
This is because the SketchUp DWG/DWF importer only includes geometry and ignores text objects.It's not foolproof - it's an old script and it is unlikely to be changed much now.
You can of course use Layout to access DWG data directly... including its text.Or stop rotating the text in the CAD drawing, or manually fix it in SketchUp after import...
-
Hi
I have dxf files with Attribute texts and when importing, then I get an error that the variable cp is not defined.
I attached a small example in order to easily reproduce the issue.
Can you fix the error?
I assume it is the same issue as in Oct 2020 with the Text.The ruby console output is:
......Making 0 TEXT Entities...
Making 0 MTEXT Entities...
Making 16 ATTRIBUTE TEXT Entities...
Error: #<NameError:**undefined local variable or methodcp' for TIG::ImportDXFtext:Module**> C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1273:in
block in make_atext'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:ineach' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:in
each_with_index'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:inmake_atext' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1776:in
import'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1799:innew' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1805:in
block in module:ImportDXFtext
-
Thanks for the report.
It was a simple typo...
I've fixed it.
An updated RBZ is now available from the PluginStore...
https://sketchucation.com/pluginstore?pln=importDXFtext -
Thanks for the quick reply.
I just downloaded, installed and tried.
But I still have the same issue and exact same error message.
Looks like a new main prog, but same code file.
Making 0 TEXT Entities...
Making 0 MTEXT Entities...
Making 16 ATTRIBUTE TEXT Entities...
Error: #<NameError: undefined local variable or methodcp'** for TIG::ImportDXFtext:Module> C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:**1273:in
block in make_atext'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:ineach' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:in
each_with_index'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1118:inmake_atext' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1776:in
import'
C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1799:innew' C:/Users/Birgit/AppData/Roaming/SketchUp/SketchUp 2022/SketchUp/Plugins/importDXFtext/importDXFtext_code.rb:1805:in
block in module:ImportDXFtext' -
And the Extension Manager reports it as the latest version v3.2 ?
I'll look at it, but the line it reports the error in should not cause this error...
Advertisement