[Plugin] Dxf_In v2.2 20110517 Dxf2Skp
-
Version 1.18 and not sure why I cannot attach anything.
Here is a link to the cad download page for the part I am trying to import.
http://catalog.catalogds.com/catalog/showPart?mfid=sdp&pn=A+6Z+3-78SF03716
i chose the "DXF file (.dxf)" option.
I also verified I can open the file in a dxf viewer so 99% sure the copy I have is good.Thanks again for taking a look. It's a simple part so can draw from scratch if I need to. But use quite a few parts from them so would be nice if I could get them to import so I have a base to draw from.
-
wireb, The dxf is a database with 2d entities created by pro/engineer as ACAD Dxf version 14.
999 Pro/ENGINEER 2005030 by Parametric Technology Corporation . . $ACADVER 1 AC1014
In the attached portion regarding a LINE from the Dxf file, note the sequence of tags 10, 20, 11, 21. These are probably coordinates from the start of the line x,y to its end x,y. Dxf_In supports and Acad Dxf v14 requires for LINE, 10, 20, 30, 11, 21, 31 (start at x,y,z to end at x,y,z).0 LINE 5 212 100 AcDbEntity 8 DEFAULT_2 100 AcDbLine 62 8 6 HIDDEN 10 11.9420742236 20 13.5330979028 11 11.9201184463 21 13.4944728974 0
I guess the reader you used overlooks this. One Acad viewer I tried rejects the file, and another non-acad viewer produced the attached 3d view of the file. Is it correct?
Notice how the model is floating above x=0,y=0,z=0 origin? Is that also correct? If there is any possibility for Dxf_In to accommodate this file, I need to know what it should look like. Finally, your Dxf includes the entity SPLINE, that Sketchup doesn't support. Dxf_In would have to change it into a polyline (a line segment made up of many stright lines) to import it. Is this OK?Btw, I think the reason you can not upload files is that as a new user, you are being temporarily blocked from uploading just in case you are a spam. Ask admin to turn on your privileges.
-
Yep that looks like the part (cog belt pulley (only 2 teeth are shown)
Segmented lines are fine by me. I can go in and touch them up manually while I am turning the 2d drawing back into a 3d part.
I think the z axis is undefined since this is a 2d print. You can lay it out at z=0 (or any value for that mater) The print is going to get cut down to just that center part (big circle) then pushed / pulled back into the 3d part. So will be moved around quite a bit.
Thanks much for taking a look at this!!
-
Yep got it and it works great. Made one change so the menu item comes up as import 2D DXF so I can have both loaded at once.
Looks like the spline were only used in the lettering and the isso view of the part and for some reason the set screw hole (no idea why that one is). The flat parts all imported with no issues other than the dotted hidden lines came in solid which is a non issue for what I am going to use it for.
after a little pushing and pulling (and manually adding the set screw hole back)
Thanks again for the help!
-
Little fix:
line 58 should be changed toext_name = name_parts[name_parts.length-1].upcase
-
Honoluludesktop,
I just found your plugin and it is what I've been looking for. I appreciate your sharing it with other users. I generate surfaces in my own program and write out a dxf file using 3dface entities. The old version of SU free read them nicely allowing me to view them in 3D. I downloaded your plugin but it isn't working for me yet. It shows on the menu under file and brings up the browser. However, I get a message "<Error> or Empty File" which I see comes from the plugin. Is there a SU setting that I'm missing or something that I may not be doing correctly?
I've attached a small sample file of the type I'm generating.
Thanks for any help,
dsct
-
ttrraa trata, thanks.
dsct, I am looking at the file.
-
dsct, TestFile.dxf contains 5 3DFACEs. The file doesn't follow the Acad specification and among other things, contains no Dxf header, no indentations for the entity codes, and 3DFACE is written "3dface" in lowercase. It will not open in a AutoCad viewer.
I believe that SU uses ODA's code for reading dxf. This translator, unlike AutoCad's translator contains workarounds for many non conforming entity codes.SUv7/ODA translates TestFile with 10 faces, scale's entities in feet, and locates the model on the ground plane.
Attached is a variant of Dxf_In that will read 3DFACEs in lower case. It translates TestFile.dxf with 5 faces, default scale in inches (may be changed in the options menu), and a elevated z axis. dxf_In_v1.18b.rbI do not know which import is more correct.Unlike the ODA, I am not incline to correct all non conforming entity codes. Because Dxf_In is a SU plugin, these corrections will slow down the program, and be less compatible with future Autocad dxf releases. Having said that, I have made changes to Dxf_In to correct some non conforming entity codes.
I will do further testing, and post any findings here. Where did you get the Dxf from? Hope that the Dxf_In variant helps you.
-
dsct, I have looked hard at TestFile.dxf, and can not find a z coordinate value following its entity code (30, 31, 32, 33) that is "0.0", which would be the case as the image of the SUv7/ODA import suggest.
-
HHF, Give this a try:
Ruby Removed, download from here.
This works with the dxf you supplied. If you come across other dxf files with entities that fail translation, please post them here. Read the application's help, there are some entities that are outside my ability to convert.I hate Dxf, it provides several ways to do the same thing, resulting in increasing the difficulty for 3d party applications to comply. My code is resonably organized, resulting in the attached fix.
-
wirdb, It would take more time then I currently have to modify Dxf_In to include 2d entities no longer supported by Acad. However I will pm you a beta version of Dxf_In_2d for 2d lines, polylines (untested), arcs, and circles. This plugin will not translate those entities into 3d, even if the information is in the file. I will not implement Splines at this time. I hope that it saves you some time in your work. Except for minor fixes, I will not be able to support this plugin.
Addenda:
Freely use, and abuse at your own risk. Fitness of use is not warranty implied. -
honoluludesktop,
Thanks for looking at my application and for the update. I really appreciate your interest and help. I tried the updated plugin on a larger file. It read in a lot of the 3dfaces but gave me a "<Error> Bad 3dface" message for the rest. I've attached a somewhat bigger sample that shows that issue. Any thoughts? It's my understanding that the sample file that I sent, TestFile.dxf, has x,y,z coordinates for all points. Some values are zero. I'm not sure that I understand your comment about the missing z's.
My use has been that of a hobbyist and found that dxf was a man readable format that I could understand and generate myself. I downloaded a guide for dxf and used it to write the files. These files read into SU and I was content with the results. It seems that you have a more definitive (and possibly different) format for dxf. Can you point me to the source for that format. Since I'm generating the file, I can conform and hopefully get the rest of the way there.
Thanks again for your help,
dsct
-
dsct, I looked at the faces that Dxf_In is rejecting and discovered that these faces are not coplaner. The attached image contains the model generated by Dxf_In in black, white, and gray. The blue line is an attempt to create a face from the existing vertices's. If the vertices's of the blue lines are coplanar, a face would be created. Because Dxf_In is a SU Ruby plugin, it seems to tolerates less variation in the vertices's values, then does the ODA translator.
In this case there are two options. One is to improve the accuracy of "Dxf Out"(s) vertex values. The other is to rewrite Dxf_In to create a triangular face from 3 vertex (as ODA does), in place of the 4 vertex 3DFACE that Acad requires. This may take time to do and you may have to wait for a Dxf_In solution. Is it difficult to improve the accuracy of "Dxf Out"? Without doing so, Autocad will not be able to read your Dxf. What may simply be required, is to increase the decimal rounding place. Say, for example, from 7 places (.00000001) to twelve (.000000000001).
The link to the Acad specifications is here. You also need a copy of a AutoCad generated Dxf in order to see some of the formatting that AutoCad requires.
-
Hmmm........Turned out to be easier to rewrite then to explain (as above).>_< Attached is Dxf_In that triangulates non coplaner 3DFACE(s). It is still to your advantage to fix "Dxf Out" in order to maintain compatibility with AutoCad. In addition, ODA/SU7 locates the translated model on SU(s) ground plane, where Dxf_In elevates it as specified. Where is the original model located in reference to the world origin? Btw: please check your pm (private mail).
Can you pm me an image of your model as it is created by your original application? -
This version allows the following non Acad compliant Dxf information to be processed:
01/10/2011 - v 1.20 Convert lower case Dxf entity names to upper case.
01/12/2011 - v 1.22 Triangulate Dxf 3DFACE when not coplaner. -
Perfect plugin to go from GIS to SketchUp when the ArcGIS->Skp6 plugin doesn't work. You've done fantastic work and you should get more recognition for it!
-
I am trying to get topographic contour lines into SU8 as vectors. Illustrator (AI) can "trace" raster images from topo maps very nicely, but then I cannot get the results into SU8.
--I created a simple filled 2-d square in AI,
--exported that as a dxf with the "AutoCAD version 2004/2005/2006" option in the AI export dialog.
--I used your plug-in (my_dxf_In_v1.22.rb) to import this file into SU8,
--and get the SU error "<Error> or Empty File".
--I tried the other export->CAD options from AI to no avail.
--Also, "polylines to faces" or "polylines to edges" made no difference.Any suggestions? Do you think AI is exporting "non-Acad-compliant" dxf?
-
It is possible that AI exports drawing entities that Dxf_In doesn't currently support. Upload the dxf file that fails to import (smaller the better), and I will look at it. Also, describe, or upload a image of the original illustration.
-
Here are 4 files for your experimentation/troubleshooting :
1.the DXF export from (1) DXF export from AI contours
2.png of (1) so you can see what the DXF is supposed to show
3.DXF export from AI of a simple, 2D square - black stroke, white fill. DXF export of filled square
4.screenshot of AI-DXF export settingsThe AI file of topo contours file would not upload; but if you can use it, I could email it to you.
Thanks for the help! -
Sorry for my lack of vocabulary here-- If the splines (curved lines) in AI were converted to a series of small straight line segments, then perhaps they would be Polylines in the dxf?
I was not able to import square.dxf, the same file you imported successfully! Any ideas? Thank you!
Advertisement