• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

[Plugin] FreeDXF Importer

Scheduled Pinned Locked Moved Plugins
148 Posts 41 Posters 174.8k Views 41 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.
  • H Offline
    hdpv
    last edited by 27 Jan 2016, 09:28

    I have some update!

    Suforyou
    http://www.sketchupforyou.com

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 27 Jan 2016, 12:04

      @mgate said:

      through the Extensions (the dwg format is not available in FreeDXF Importer plugin)[

      You can select a .dwg or a .dxf file and it should import...

      @unknownuser said:

      it required an additional file or library called "fileutils"? If so, that file is missing inside "jf-freedxf" folder.

      that's in the SU Ruby folder, so it's already available from there...

      have you tried it with 'Ruby Console' open to see if there are any error messages?

      the other thing to try is doing the conversion directly in TeighaFileConverter, if it fails there you may get a reason given...

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 27 Jan 2016, 22:24

        Actually, I don't think fileutils is needed. I think I was going to use some methods in fileutils to search for the Teigha converter on the disk drive, but haven't got back to it.

        You can remove or comment out the line.

        Hi

        1 Reply Last reply Reply Quote 0
        • M Offline
          mgate
          last edited by 28 Jan 2016, 13:35

          neither working if commented out the "fileutils" line.

          I have a folder with two files in dxf and dwg formats:
          snapshot of folder with dwg and dxf files
          Once opened the "FreeDXF v.0.11.2" pop-up window, there is only the dxf file (the dwg file is not available):
          snapshot of FreeDXF pop-up window

          Is there a problem with "extra extensions"?

          def self.select_file(extra_extensions = "")
                title     = 'FreeDXF Select DXF File'
                directory = nil
                # filename  = 'DXF|*.dxf|DWG|*.dwg||'
                filenames = "Cad Files|*.dxf" + extra_extensions + "||"
                file_path = UI.openpanel(title, directory, filenames)
                if file_path.nil?
                  return nil
                else
                  file_path.tr!('\\', '/')
                  @last_selected_file = file_path
                  return file_path
                end
              end
          
              def self.main
                 puts "\nFreeDXF debugging ON." if $JFDEBUG
                 extra_extensions = Teigha.available? ? ";*.dwg" ; ""
                 file_path = select_file(extra_extensions)
                 return if file_path.nil?
                 #file_path.downcase!
                 if file_path.end_with?(".dwg")
                    Teigha.dialog()
                    file_path = Teigha.convert(file_path)
                    if file_path.nil?
                       puts "dxf file was not created."
                       return
                    end
                 end
          

          Any idea how to solve?
          Another way is to convert dwg files manually with TeighaFileConverter, and then use FreeDXF plugin in SKU.
          Sorry to snoop around your codes 😐

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by 28 Jan 2016, 17:20

            This appears to be due to a difference between SketchUp 15 and SketchUp 16 UI.openpanel behavior.

            As a short-term work-around, can you try to enter a * then press ENTER in the filename dropdown to force all files to be listed?

            Hi

            1 Reply Last reply Reply Quote 0
            • A Offline
              atelierpaar
              last edited by 5 May 2016, 12:10

              Hello Jim
              A couple of days ago I posted a request for a plugin that would import measurements directly from a 3D Laser "Leica Disto S910 " in order to draw direct on site.

              http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=64830%26amp;p=594596#p594596

              Could your plugin be developed to do the Job ?
              Thanks for your response
              Uli

              1 Reply Last reply Reply Quote 0
              • K Offline
                Kuu
                last edited by 14 Oct 2016, 22:44

                Nice plugin, works much better than the SketchupPro import. However, there's a few things I've noticed:

                • It does not respect blocks' scaling / orientation properly: blocks that were mirrored in the original DXF sometimes end up in strange positions (this does not happen with the other import).

                • Perhaps related to the last issue, sometimes I saw blocks that had the proper orientation but had ellipse elements that were rotated in 90 or 180 degrees.

                • Layer colors? Why doesn't it keep the DXF layer colors the way the sketchup-included DXF importer does? Currently I work around this by importing it with one (to get the layer colors) and then delete all the geometry/components and reimport with yours, would be awesome to not have to do this.

                • It would be nice if the import also preserved layer visibility, or have a toggle to choose on import. Currently it sets all the layers to visible.

                • Another toggle to merge DXF layer 0 to sketchup's Layer0 would be handy too.

                • Is it possible for it to keep polylines? I don't know if it's a DXF limitation or Sketchup or what. Polylines would be a godsend!

                I'm on SketchUp 2016 and macOS 10.11.6 in case that's relevant...

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jim
                  last edited by 15 Oct 2016, 07:49

                  @kuu said:

                  Nice plugin, works much better than the SketchupPro import. However, there's a few things I've noticed: ...

                  Hi Kuu, thanks for the feedback.

                  It does not respect blocks' scaling / orientation properly: blocks that were mirrored in the original DXF sometimes end up in strange positions (this does not happen with the other import).

                  Could you provide a minimal .dxf example file, and example result?

                  Perhaps related to the last issue, sometimes I saw blocks that had the proper orientation but had ellipse elements that were rotated in 90 or 180 degrees.

                  Maybe related, maybe not - ellipses have proven difficult to crack but it's been awhile since I've had a look at it. Again, a minimal sample file demonstrating an incorrect ellipse would be helpful.

                  Layer colors? Visibility?

                  I wrote this long before SketchUp had support for setting layer colors. Now it does. Can have a look.

                  Hi

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    Elektro
                    last edited by 26 Oct 2016, 18:09

                    Good evening.
                    I have installed the latest version freeDXF 16th in Sketchup 2016, but I can not
                    to import any DXF files.
                    I tried to install the older version of freeDXF but nothing has changed.
                    Some solution?

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by 28 Oct 2016, 11:41

                      @elektro said:

                      Good evening.
                      I have installed the latest version freeDXF 16th in Sketchup 2016, but I can not
                      to import any DXF files.
                      I tried to install the older version of freeDXF but nothing has changed.
                      Some solution?

                      If you open the Ruby Console before attempting to import using FreeDXF, then are there any errors that appear?

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Elektro
                        last edited by 28 Oct 2016, 18:40

                        Hello Jim.
                        No before pressing 'Import' in Ruby Console nothing appears, but after I pressed the 'Import' button appears this error:

                        Error: #<Encoding::UndefinedConversionError: "\x90" to UTF-8 in conversion from Windows-1252 to UTF-8>
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/dxf2ruby.rb:181:in gets' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/dxf2ruby.rb:181:in read_codes'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/dxf2ruby.rb:58:in parse' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:269:in import'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:236:in do_import' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:136:in block in do_options'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:82:in call' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:82:in block in trigger_event'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:78:in each' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:78:in trigger_event'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:357:in event_control_callback' C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:311:in callback_handler'
                        C:/Users/Roberto/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:269:in block in add_callback' SketchUp:1:in call'

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jim
                          last edited by 28 Oct 2016, 20:47

                          Oh so it's an encoding issue. Can you share the file here or in a private message? I don't have an example with which to work out a solution.

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • E Offline
                            Elektro
                            last edited by 29 Oct 2016, 15:13

                            @jim said:

                            Oh so it's an encoding issue. Can you share the file here or in a private message? I don't have an example with which to work out a solution.

                            Hello Jim I have attached the file you that I can not open in Sketchup 2016.
                            If this can be of help, this file was saved as 'AutoCAD 2013 Compatible DXF (*.dxf)

                            File_1.dxf

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jim
                              last edited by 29 Oct 2016, 15:42

                              One thing you can try while I work on a fix is to open the .dxf file in an editor such as Notepad++, set the encoding to utf-8, then save the file. It should import correctly.

                              But might lose some characters such as this one:

                              
                              puts "\x90".force_encoding("cp1251").encode("utf-8")
                              ђ
                              
                              

                              Hi

                              1 Reply Last reply Reply Quote 0
                              • E Offline
                                Elektro
                                last edited by 29 Oct 2016, 16:47

                                @jim said:

                                One thing you can try while I work on a fix is to open the .dxf file in an editor such as Notepad++, set the encoding to utf-8, then save the file. It should import correctly.

                                But might lose some characters such as this one:

                                
                                > puts "\x90".force_encoding("cp1251").encode("utf-8")
                                > ђ
                                > 
                                

                                I did the test that you have advised me, but nothing has changed.
                                Instead I have converted the files in ANSI, I saved it, and then I imported into Sketchup and ...... cheers now works. 😄

                                1 Reply Last reply Reply Quote 0
                                • G Offline
                                  GraceAE1
                                  last edited by 4 Nov 2016, 08:15

                                  I was loving this plug-in , really useful thank you!

                                  But...alas.. it stopped working on me this morning, it gets to the import screen and then doesn't do anything once I click import. It says at the bottom that it is 'parsing' but nothing more. I have uninstalled and reinstalled. I wonder if anyone has had the problem and if there is either something I am doing wrong, or if this is a common problem?

                                  I am using Sketchup Make 2016. and AutoCAD LT 2017. But i have tried saving in previous dxf versions of AutoCAD.
                                  Hoping you can help.

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    Jim
                                    last edited by 4 Nov 2016, 09:35

                                    @graceae1 said:

                                    I was loving this plug-in , really useful thank you!

                                    But...alas.. it stopped working on me this morning, it gets to the import screen and then doesn't do anything once I click import. It says at the bottom that it is 'parsing' but nothing more. I have uninstalled and reinstalled. I wonder if anyone has had the problem and if there is either something I am doing wrong, or if this is a common problem?

                                    I am using Sketchup Make 2016. and AutoCAD LT 2017. But i have tried saving in previous dxf versions of AutoCAD.
                                    Hoping you can help.

                                    That's odd. Did it stop working for one particular file, or for all files?

                                    Did you make any other changes to your setup?

                                    Can you please try to import with the Ruby Console window open and see if any errors show up there?

                                    Hi

                                    1 Reply Last reply Reply Quote 0
                                    • G Offline
                                      GraceAE1
                                      last edited by 4 Nov 2016, 17:02

                                      Not sure if this contains errors but this is the last few lines of my ruby console:

                                      FreeDXF/SKUI/window.rb:269:in block in add_callback' SketchUp:1:in call'

                                      It has stopped working for all files. And i did keep with the same settings. I did try it with a lower circle segment geometry setting just to see if that made a difference...but it didn't.

                                      1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        Jim
                                        last edited by 4 Nov 2016, 17:40

                                        Actually, it is the top lines that are most important. Sorry for not being clear.

                                        Hi

                                        1 Reply Last reply Reply Quote 0
                                        • G Offline
                                          GraceAE1
                                          last edited by 4 Nov 2016, 18:09

                                          Ah yes sorry this makes more sense:
                                          Error: #<Encoding::UndefinedConversionError: "\x81" to UTF-8 in conversion from Windows-1252 to UTF-8>

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

                                          Advertisement