[Plugin] importDXFtext
-
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... -
The good news is I've managed to stop that error.
The bad news is that SketchUp now Bugsplats after the import...
So some work to do ! -
I've now traced the Bugsplat - only happens when choosing mm as units - suspect it's because the size of the ext is too small and 1/1000" is SketchUp's tolerance...
Testing a trap for this... -
Here's v3.3
https://sketchucation.com/pluginstore?pln=importDXFtext
It now sidesteps the 'cp' error message and also avoids a possible Bugsplat when processing Atxt, if you choose mm [or even cm] as your imported DXF's units the tiny size of any Attribute-text could result in very small geometry that crashes SketchUp, so in that case there's a closing message-box to warn you and the imported Attribute-text's units are assumed to be in inches, just for that DXF text-type...
Please test and report back as necessary... -
Hi TIG
SketchUUp Ext. manger showed 3.2 after install. But I did not see the
line with**cp =**gents.add... in the code file.Agree, the fix is to be applied about 10 lines further up than what is reported in the console.
I think I also had crashes in Sketchup when working with mm.
Cool, you could find a work around!Downloaded and installed version 3.3. So far all good.
Will test later today and let you know. -
out of curiosity, not saying it is wrong or I would know why
Yesterday evening, for testing, I did the same change for make_atext as it stands in make_mtext and then it worked.For ***make_text ***and make_mtext you assigned the variable cp:
if string.tr(' ','').gsub(/\\P/,'')=="" string="" ***cp = gents.add_cpoint(ORIGIN)*** puts "Empty String = Cpoint" next #height=100.mm end#if ### bold=false;italic=false ### begin ### gents.add_3d_text(string,align,font,bold,italic,height,0.0,0.0,true,thick) if string && string !="" rescue Exception => ex puts ex ensure ### ? end next unless gp.valid? ***cp.erase! if cp && cp.valid?*** # we don't need a cpt inside text??
But for make_atext, you commented out the line causing errors:
if string.tr(' ','').gsub(/\\P/,'')=="" string="" ***gents.add_cpoint(ORIGIN)*** puts "Empty String = Cpoint" next end#if string=string.strip.gsub(/\\P/,"\n")### replace \P with \n ### bold=false;italic=false ### begin gents.add_3d_text(string,align,font,bold,italic,height,0.0,0.0,true,thick) if string && string !="" rescue Exception => ex puts ex ensure ### ? end next unless gp.valid? ***#cp.erase! if cp && cp.valid?*** # we don't need a cpt inside text??
-
It's possible to have an empty text string in ACAD Mtext etc, to trap for it I add a cpoint into the group containing the possible text - to ensure the group isn't prematurely deleted as there's no geometry made - at the end that cpoint is deleted to tidy up.
As it isn't needed in the Atxt, putting the # in front of the relevant line fixes the error message.The unrelated splat with tiny text from Atxt when using model-mm is trapped by forcing inches for Atxt height when import units are set to mm/cm...
-
Ok, Clear, makes sense.
I tested and it turns out, that AText is by a factor of 39 too small (100/2.54).
So if I have a MText or Text at position (x,y,z) = (100mm, 100mm, 0mm) then the MText is imported into SketchUp at the right position, but the AText being at the same position in DXF, ends up in SketchUp at (2.54mm,2.54mm,0mm).
Also the height of the Text is much smaller.I imported indicating units = meter.
Probably this is the reason why if choosing MilliMeter for import, it crashes, because a few mm divided by 39 is giving a too small text size.
Advertisement