[Plugin] FreeDXF Importer

Re: [Plugin] FreeDXF Importer

Postby Elektro » Wed Oct 26, 2016 7:09 pm

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?
0

Elektro 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Fri Oct 28, 2016 12:41 pm

Elektro wrote: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?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby Elektro » Fri Oct 28, 2016 7:40 pm

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'
0

Elektro 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Fri Oct 28, 2016 9:47 pm

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.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby Elektro » Sat Oct 29, 2016 4:13 pm

Jim wrote: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
0

Elektro 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Sat Oct 29, 2016 4:42 pm

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:

Code: Select all
puts "\x90".force_encoding("cp1251").encode("utf-8")
ђ
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby Elektro » Sat Oct 29, 2016 5:47 pm

Jim wrote: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:

Code: Select all
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. :D
0

Elektro 
 

Re: [Plugin] FreeDXF Importer

Postby GraceAE1 » Fri Nov 04, 2016 9:15 am

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.
0

GraceAE1 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Fri Nov 04, 2016 10:35 am

GraceAE1 wrote: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?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby GraceAE1 » Fri Nov 04, 2016 6:02 pm

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.
0

GraceAE1 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Fri Nov 04, 2016 6:40 pm

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

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby GraceAE1 » Fri Nov 04, 2016 7:09 pm

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

GraceAE1 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Fri Nov 04, 2016 9:45 pm

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


This error is because I am guessing all DXF files are encoded using Windows-1252 which is not always correct. However, I don't know of a way to guess the encoding of the files in order to read them correctly in Ruby. From what I have found it is not easy.

If you need a quick fix you can try re-encoding the file in a text editor such as Notepad++ (see just a few posts previous).

I am interested in having the file so I can check the HEADER section. The HEADER section of DXF files may have the correct encoding. Can you share it here or in a private message?
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby gwirth » Mon Nov 28, 2016 11:37 pm

Is there any way to get old plugins, specifically 0.57? I have some training material that uses SketchUp 8.0 and OpenStudio to do some energy modeling and the training material uses the FreeDXF 0.57 to import some DXF files.

I would like to try using the existing training material without having to go through and find out what is different so that I can concentrate on the concepts and not the software.

I saw that Jim has a site on GitHub but I didn't see any old releases there. I've tried searching all over with Google but I can't find it anywhere.

Gus Wirth, M.Sc.S.E
Chief Engineer
Anchors Aweigh Energy, LLC
0

gwirth 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Tue Nov 29, 2016 1:27 pm

gwirth wrote:Is there any way to get old plugins, specifically 0.57? I have some training material that


Hi Gus,

You will need to wait until this afternoon but I can send you a version that works in SketchUp 8.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Tue Nov 29, 2016 11:43 pm

Gus - check your messages.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby juju » Wed Nov 30, 2016 7:35 am

Jim, would your importer be written in C/C++ by any chance? If so, how much of a stretch would it be to get it to work in LO?
0
Save the Earth, it's the only planet with chocolate.
User avatar
juju 
Premium Member
Premium Member
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Wed Nov 30, 2016 9:24 am

juju wrote:Jim, would your importer be written in C/C++ by any chance? If so, how much of a stretch would it be to get it to work in LO?


Well, it would be a huge stretch as FreeDXF is a Ruby extension. I don't have plans to re-write it as a C/C++ extension.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby gwirth » Sat Dec 03, 2016 12:55 am

I did some more digging around and finally found the FreeDFX-v0.57 plugin that I was looking for that works with my training materials. Is there somewhere I can upload it to so that others can find it as well?

Smooth Sailing,

Gus
0

gwirth 
 

Re: [Plugin] FreeDXF Importer

Postby Jim » Sun Dec 04, 2016 4:43 pm

gwirth wrote:I did some more digging around and finally found the FreeDFX-v0.57 plugin that I was looking for that works with my training materials. Is there somewhere I can upload it to so that others can find it as well?

Smooth Sailing,

Gus


You can just attach it to a reply here on this topic.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] FreeDXF Importer v0.57 for SketchUp 8

Postby gwirth » Mon Dec 05, 2016 10:07 pm

Here is the FreeDXF-0.57 plugin for use with SketchUp 8.0 It is needed to go with the training materials for the California Energy Commission (CEC) CBECC-Com energy modeling software using the OpenStudio plugin for SketchUp.

Gus
0

gwirth 
 

Re: [Plugin] FreeDXF Importer

Postby Aurust » Thu Sep 14, 2017 7:24 pm

I'm having an issue getting this to work on a DXF file saved as 2010 version. I get this error in the Ruby console when I try to import:

Error: #<NoMethodError: undefined method `empty?' for nil:NilClass>
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:1014:in `draw_mtext'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:390:in `draw'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:286:in `block in import'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:271:in `each'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:271:in `import'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:236:in `do_import'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/freedxf.rb:136:in `block in do_options'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:82:in `call'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:82:in `block in trigger_event'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:78:in `each'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/events.rb:78:in `trigger_event'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:357:in `event_control_callback'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:311:in `callback_handler'
C:/Users/TEMP.AAP.000/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/jf-FreeDXF/SKUI/window.rb:269:in `block in add_callback'
SketchUp:1:in `call'

Any ideas what is going on?
0

Aurust 
 

Re: [Plugin] FreeDXF Importer

Postby TIG » Fri Sep 15, 2017 10:39 am

Until Jim fixes it...
I suspect you have a piece of Mtext in the DXF which is flaky.
Currently the code checks if its 'sting' is empty before continuing, but it doesn't check if it exists !
Edit the file using Notepad++ [TextWrangler on MAC].
Find line 1014 and edit it as follows...
return if txt.empty?
should become...
return if txt.nil?; return if txt.empty?

There might be other instances of this in the code ?
You can search for the other three uses of .empty? and ensure that before each test the existence of the relevant reference with .nil? is invoked. One is already trapped with a return, the next one needs a similar line adding as a fix. The line reading next if l.empty? needs a preceding next if l.nil? as that is inside a 'block' rather than in a 'method' and so it should not have a return.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] FreeDXF Importer

Postby ronjohnson936 » Sat Jan 13, 2018 10:17 pm

I tried to import a .dxf file saved from Inkscape as an Autocad DXF R14 format and nothing happens.
0

ronjohnson936 
 

Re: [Plugin] FreeDXF Importer

Postby TomDAYarch » Thu Jan 25, 2018 2:17 pm

When I install the plugin and reopen SkUp (2017), I have an error message appear, telling me:

Error Loading File C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb
Error: #<SyntaxError: C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:658: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when 1: v = [0 , -h]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:659: syntax error, unexpected keyword_when, expecting keyword_end
when 2: v = [-w/2.0, -h]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:660: syntax error, unexpected keyword_when, expecting keyword_end
when 3: v = [-w , -h]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:661: syntax error, unexpected keyword_when, expecting keyword_end
when 4: v = [0 , -h/2.0]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:662: syntax error, unexpected keyword_when, expecting keyword_end
when 5: v = [-w/2.0, -h/2.0]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:663: syntax error, unexpected keyword_when, expecting keyword_end
when 6: v = [-w , -h/2.0]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:664: syntax error, unexpected keyword_when, expecting keyword_end
when 7: v = [0 , 0]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:665: syntax error, unexpected keyword_when, expecting keyword_end
when 8: v = [-w/2.0, 0]

^
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb:666: syntax error, unexpected keyword_when, expecting keyword_end
0

TomDAYarch 
 

Re: [Plugin] FreeDXF Importer

Postby TIG » Thu Jan 25, 2018 4:40 pm

Jim decided to no longer support it, and it's no longer available from the PluginStore.

As it's an RB file you can edit it using a plain-text editor like Notepad++.
C:/Users/Resource/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/freedxf/freedxf.rb
Do this only for yourself, because posting or distributing an altered version might infringe the author's copyright?

The allowable syntax in 'case' structures changed with newer Ruby versions...
Find the lines throwing the error, they seem to start around line #658 - e.g.
when 1: v = [0 , -h]
and replace the : (colon) with a ; (semicolon) so it becomes:
when 1; v = [0 , -h]

Repeat this editing for all of the other when lines which include the troublesome :

Save the changed RB file and restart SketchUp...
See if the error has be sidestepped...

If not. then report the next set of error-messages !
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Previous


 

Return to Plugins

Who is online

Users browsing this forum: archano, darospa, fq_3, henmill, kajka, manishthigale1881, yc_bonani and 15 guests

Visit our sponsors: