• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] importDXFtext

Scheduled Pinned Locked Moved Plugins
165 Posts 18 Posters 84.8k Views 18 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    TIG Moderator
    last edited by TIG 25 Oct 2009, 11:50

    Now you can import 'flat' DXF text to match your imported DXF geometry...

    (c) TIG 2009-2017

    importDXFtext.rb

    It is an Extension [>=v2.0] - so ensure it's activated...

    Run the tool by typing in the Ruby Console:

    TIG::ImportDXFtext.new

    or [ the best as the Console being open slows it down...]

    Menu > File > Importdxftext...

    Select the DXF file [text-type] from the first dialog.

    Select the DXF's Units in next dialog.

    Progress is reported in the Ruby Console OR the status-bar.
    It takes about a second per text element - so edit the DXF to minimize what's imported, no need to import what you don't want !

    It then imports any Text/Mtext/AttributeText in the DXF file.

    It makes it as groups of '3Dtext'.

    It uses the DXF's Styles data to set the:

    Font, Height, Color, etc

    It uses the Text/Mtext/AttributeText data to set the:

    TextString, LocationXYZ, Rotation, Height, Justification, StyleData, Layer etc

    Mtext might also have additional internal formatting [like a boundary causing wrapping in CAD], but only carriage-returns are read [\P == \n]

    Other formatting is ignored and the base Style is used... e.g.

    \Hnx for x height for some text
    \Hn for set height for some text
    |b0| for Bold to some text
    |i0| for Italic to some text
    |c0| for Color to some text

    etc are all ignored.

    Text/Mtext/AttributeText inside a Block/Insert is also imported.

    The Text/Mtext/AttributeText Layers are preserved.

    The Text/Mtext/AttributeText Color is set from the Layer Color or its Color if set otherwise - note that only the base 255 standard ACI colors are used - the first 9 by name the rest by ACI-code: and any others [e.g. pantone_colors] revert to 'Black'.

    Any DXF Font that's not available on your Computer defaults to 'Arial'.

    Note that only the Text/Mtext/AttributeText Entities are imported and that all other Geometry etc must be imported in the 'conventional' manner, separately...

    It's recommended that where separately imported DXF Text is to be 'matched' that when Importing the DXF's Geometry the Option is set to 'Preserve Drawing's Origin' [not usually recommended for extreme origin offsets] - otherwise the Imported Text [that must use that Origin] will probably be displaced, and perhaps awkward to relocate properly!

    Note that it can take a while to process complex Mtext strings...
    so be patient...

    v1.1 20091028 Menu added. Glitch with 'empty' strings fixed.
    v1.2 20091029 Further glitches with 'empty groups' trapped:
    any 'empty' strings marked with cpoint:
    text-group/s does not now cast/receive shadows:
    progress shows on VCB as well as Console.
    v1.3 20131212 Future-proofed.
    v2.0 20170419 Updated to newer SketchUp/Ruby compatibility etc...

    Link Preview Image
    SketchUp Plugins | PluginStore | SketchUcation

    SketchUp Plugin and Extension Store by SketchUcation provides free downloads of hundreds of SketchUp extensions and plugins

    favicon

    (sketchucation.com)

    TIG

    1 Reply Last reply Reply Quote 0
    • C Offline
      CadFather
      last edited by 26 Oct 2009, 16:36

      Thanks TIG, if it works is one of those musts

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 26 Oct 2009, 22:25

        @cadfather said:

        Thanks TIG, if it works is one of those musts

        if it works ! Of course it works ! Of course it could be improved.... but this is its first release ! πŸ˜‰

        Comments and feed back please... So far 27 down-loaders - 1 comment ?

        TIG

        1 Reply Last reply Reply Quote 0
        • C Offline
          CadFather
          last edited by 27 Oct 2009, 08:13

          πŸ˜„

          TIG i think a menu would be a nice addition.. ..might make testing simpler

          first try:

          Making 0 TEXT Entities...
          Making 144 MTEXT Entities...
          Error; #<TypeError; C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;909;in `bounds'; reference to deleted DrawingElement>
          C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;909
          true
          

          must be something i missed

          1 Reply Last reply Reply Quote 0
          • M Offline
            Mike Lucey
            last edited by 27 Oct 2009, 09:58

            Thanks TIG,

            I haven't had a need to import DXF text of late but have have (a lot) in the past, so this will be bloody useful and a big time saver when I need it again πŸ‘

            I have no doubts that it will work perfectly πŸ˜‰

            Mike

            Support us so we can support you! Upgrade to Premium Membership!

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 27 Oct 2009, 10:40

              @cadfather said:

              πŸ™‚

              TIG i think a menu would be a nice addition.. ..might make testing simpler

              first try:

              Making 0 TEXT Entities...
              > Making 144 MTEXT Entities...
              > Error; #<TypeError; C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;909;in `bounds'; reference to deleted DrawingElement>
              > C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;909
              > true
              

              must be something i missed

              The next version will have a menu item.
              The error you report seems to be caused by having a piece of Mtext that's only a <space> and no actual characters to make into a group - I'll trap for that so the error is ignored - watch out for an update later today...

              TIG

              1 Reply Last reply Reply Quote 0
              • P Offline
                Panga
                last edited by 27 Oct 2009, 12:05

                Thanks a lot for this one...long time wanted !!

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 28 Oct 2009, 09:50

                  Here's v1.1 that has a menu item and the empty string glitch fixed...
                  http://forums.sketchucation.com/viewtopic.php?p=194488#p194488

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    CadFather
                    last edited by 28 Oct 2009, 16:37

                    Thanks TIG - i get this error.. but i will try other files as well

                    Error; #<TypeError; C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;923;in `bounds'; reference to deleted DrawingElement>
                    C;/Program Files/Google/Google SketchUp 7/Plugins/_importDXFtext.rb;923
                    
                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 28 Oct 2009, 17:04

                      I reproduced the error occur by having a piece of Mtext with only a space or carriage-return in it. That's trapped - must be something similar although I thought I'd trapped all calls for bounds etc if the group wasn't valid? Please see if you can find what's causing the problem and report back - it can't be that hard to trap for if we know what it is ! πŸ’­

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        TIG Moderator
                        last edited by 29 Oct 2009, 10:06

                        Here's v1.2 http://forums.sketchucation.com/viewtopic.php?p=194488#p194488

                        It should stop some of those errors - please try and feed back...
                        Empty strings are now show with a Cpoint, the grouped text does not cast or receive shadows and the VCB now shows progress as well as the Console if preferred...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • R Offline
                          redsteel
                          last edited by 20 Feb 2011, 22:36

                          Thank you very much for this, for once i was getting really pissed with SU but your work it's a life saver, thanks again.

                          ...btw, is there a menu version? πŸ˜„

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            TIG Moderator
                            last edited by 23 Mar 2011, 22:57

                            Alex
                            You didn't specify the DXF's units...
                            I downloaded your file anyway
                            I got a Bugsplat importing it using 'mm'!
                            Importing it using 'm' I did get some rapid output in the Ruby Console... then an error after some importing...
                            This is everything imported Capture.PNG This is an extract of a part of it Capture1.PNG
                            The Ruby Console output failed on a layer name 'T' not being defined.
                            That layer name is used for Lines, but as far as I can see not for 'Text' ?
                            BUT then there are almost 150,000 lines of code in the DXF file [it's 'NOT BIG' 😲 ] !
                            The DXF won't load into AutoCAD at all !!! ... so I suspect it is corrupt in some way ??
                            The error is "Unknown value "AC1024" encountered in drawing version" - I only have ACAD2008 so perhaps it's made in an NEWER version? DWG convert might work if it were a DWG file... BUT it's a DXF file πŸ˜•
                            I also made a layer named 'T' before trying 'meters' for the import units and got this result - after a looooong wait - with no errors...Capture2.PNG detail Capture3.PNG I can't believe you want ALL of this text importing - try to reduce the content of the DWG>>DXF and save in an older version like r2004, as it will import cleaner and quicker... πŸ˜’

                            Could you edit the CAD file so it only contains 'text' and retry...

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • A Offline
                              alexdobras
                              last edited by 24 Mar 2011, 00:23

                              i tried to import a dxf and SU is crashing. It is not a big file.
                              you can check it out: http://dl.transfer.ro/transfer_ro-23mar-7b7d941ec2f2cc8f.zip (it expires in 10 days)

                              1 Reply Last reply Reply Quote 0
                              • A Offline
                                alexdobras
                                last edited by 24 Mar 2011, 11:49

                                yeah, for some reason the file cannot import into Acad. I had a dwg, which i saved into dxf in order to work with the file in SU andBlender. Now, Blender 2.49 imports the file perfectly, i mean flawlessly with text and everything like i see it on CAD software i use: DraftSight. When i open the file in SU, the same file as in Blender, the model comes with a lot of deformations and with the text missing- I mean through SU 8 PRO native dwg/dxf importerthat comes with the pro version. No matter is dwg or dxf the file will import bad.
                                So i am using this plugin in http://forums.sketchucation.com/viewtopic.php?f=323&t=31186&start=75, which actually doesn't deform the model, but takes more time to import the file. The only problem is it doesn't import the text, and the model need to have everything exploded, so no blocks.
                                I hope you did understand about what i am talking about

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  TIG Moderator
                                  last edited by 24 Mar 2011, 14:08

                                  Sketchup doesn't import dwf/dxf text that's why I wrote the script...
                                  It is a good idea to reduce the dxf down to just the text items- it speeds the import and aaoids errors. It's easy to make a copy of the file in your CAD app and then filter to leave just the dtext/mtext etc, then purge and audit the dwg, then finally save as a ~r2004 DXF...

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    alexdobras
                                    last edited by 24 Mar 2011, 19:00

                                    @tig said:

                                    Sketchup doesn't import dwf/dxf text that's why I wrote the script...
                                    It is a good idea to reduce the dxf down to just the text items- it speeds the import and aaoids errors. It's easy to make a copy of the file in your CAD app and then filter to leave just the dtext/mtext etc, then purge and audit the dwg, then finally save as a ~r2004 DXF...

                                    i have done what you said, and still SU crashes right before imports the text 😐

                                    here is the 2004 ASCII drawing.DXF , only with text (just text)

                                    btw, i have intel i5 750, 2gb ddram3, video Geforce GTS250, win7 64 bit, and SU8

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      TIG Moderator
                                      last edited by 24 Mar 2011, 23:18

                                      You have NOT trimmed down the file to include just 'Text' !!
                                      You have simply switched other layers 'off' - these are still there and so Sketchup WILL try to import them !!!
                                      Here's a properly reduced version of the DXF...TESTTEXT2004.dxf And the resultant SKP.TESTTEXT2004.skp

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • A Offline
                                        alexdobras
                                        last edited by 24 Mar 2011, 23:34

                                        @tig said:

                                        You have NOT trimmed down the file to include just 'Text' !!
                                        You have simply switched other layers 'off' - these are still there and so Sketchup WILL try to import them !!!
                                        Here's a properly reduced version of the DXF...

                                        i tryed what you have sent me
                                        still, it crashes
                                        now see for yourself:click on TΓ©lΓ©charger ce fichier
                                        http://dl.free.fr/getfile.pl?file=/r36AYYVu

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          TIG Moderator
                                          last edited by 24 Mar 2011, 23:37

                                          BUT you tried to import it in 'mm'... I did it in 'm' - as I explained before.......
                                          I worked fine for me...
                                          WHAT are the units you are working in ... 😲

                                          TIG

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 8
                                          • 9
                                          • 1 / 9
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement