Dxf free or cheap editor that can add layers names to drawings for use with Biesseworks


I do need to find a free or cheap easy editor can be used to import dxf r12/r13 files, add layer names to it and export again the file.

I need this tool to import layered files into biesseworks cam, so to bypass the long and complicated procedures of this software.

Does anyone know what I should use?

If yes how must be done this simple operation with the suggested program?

I need it to convert dxf simple files into dxf files with layer names, I do not want autocad as it is expensive and not my cup of tea in principle.

I do not need to modify anything, add anything or remove anything.

I only need to import the dxf, mantaining groups and geometry types (for example polylines must be kept as polylines, arches as arches and so on), it is important as becomes easy to assign layer's names and the work will not be ruined by geometry approssimations and type changes.

At least the kind of lines and geometries must be preserved, if groups are gone it is not really fine but will be ok anyway.

So then I need to create layers with specific names.

Once done that I only need to export it again to dxf format, possibly again in r12 format (but I will ask the technicians which version is able to import the biesseworks so to be more precise with my question).

Nothing else I guess.

I do use another cad to draw and edit the drawings in general, but it is not able to create layers that can be exported to dxf.

Thank you.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DXF files are just text files. You can just go to the Layer table section and add new entries in notepad if you wish. Just get the output from a drawing that has the layers you desire, look under the TABLE section, look for LAYER and then each layer will be described by the text between each instance of the Line LAYER. Cut and paste this into you new DXF layer table section.

DaxitAuthor Commented:
Hi Borgunit

Fine. I understand this, but it does not seem easy to me. Imagine a 430 x 220 cm rectangle filled up with nested complex shapes, each shape may have many other nested shapes inside, alike lines, circles, writtens, triangles, rounded corner rectangles etc....

I do not have even one of this files with named layers to observe it, and then if I have it how can I recognize what is what i have to name as a layer???

If you know this kind of text files can you explain me with a easy example what should be done?

I am fon of notepad ++ to edit such a file, but again, have no idea at all of the language used and how to interpreter it.

If I can reach to undersatnd it it would be great though as exist a easy layer names generator that creates the right names to go straight to cam bypassing also paths creation.

So i like a lot your idea, but I guess it is very time consuming, is it so or simply I just don't know it?

Thank you
Tommy KinardCommented:
The code posted was written to read a acad dxf file version 12. it will read the file, insert the layers you have added to the file and write the file back in the same place. I tested with 3-6 layers being added. I only have the layers setup for continuous linetypes and the color is a number.

As always please back up your data before testing. You now have a brake light warrenty. :)
Option Explicit

Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long

 '### define type to pass to GetOpenFileName function
    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    lpstrFilter As String
    lpstrCustomFilter As String
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As String
    nMaxFile As Long
    lpstrFileTitle As String
    nMaxFileTitle As Long
    lpstrInitialDir As String
    lpstrTitle As String
    flags As Long
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
End Type

Function GetJobFile() As String
    OFName.lStructSize = Len(OFName)
    OFName.lpstrFilter = "DXF Files(*.dxf)" & Chr(0) & "*.dxf" & Chr(0)
     'create a buffer for the file
    OFName.lpstrFile = Space(6000)
     'set the maximum length of a returned file
    OFName.nMaxFile = 6001
     'Create a buffer for the file title
    OFName.lpstrFileTitle = Space(6000)
     'Set the maximum length of a returned file title
    OFName.nMaxFileTitle = 6001
     'Set the initial directory
    OFName.lpstrInitialDir = "C:\"
     'Set the title
    OFName.lpstrTitle = "Select DXF File..."
     'allow multiple file selection and show "new" explorer
    'OFName.flags = "&H80200"
    'allow single file selection and show "new" explorer
    OFName.flags = "&H80000"
     'Show the 'Open File'-dialog
    If GetOpenFileName(OFName) Then
        GetJobFile = Replace(Trim(OFName.lpstrFile), Chr(0), "")
        MsgBox "A file was not selected!"
        GetJobFile = vbNullString
    End If
End Function
Public Function GetStrFile$(iFName$)
    Dim mFno As Long, mLen As Long
    mFno = FreeFile
    Open iFName For Input As #mFno
    mLen = LOF(mFno)
    GetStrFile = Input(mLen, #mFno)
    Close #mFno
End Function
Sub AddLayer()
    Dim MyDXFFile As String, LyrNm() As String, LyrStrt As Long, LyrNum As Long
    Dim DXFInfo As String, LyrClr() As String, LookFr As String, GetNumLyr As String
    Dim LyrAddStr As String, mI As Long
'add/change the layer names here
    LyrNm = Split("LollyPoP,PoPLolly,NannyPippens,anothername,thenan,opps", ",")
'add/change the colors here
    LyrClr = Split("1,2,3,4,5,6", ",")
    LyrAddStr = ""
    'get dxf file name
    MyDXFFile = GetJobFile
    'read in the information
    DXFInfo = GetStrFile(MyDXFFile)
    'look for the layers
    LookFr = "0" & vbCrLf & "TABLE" & vbCrLf & "  2" & vbCrLf & "LAYER" & vbCrLf & " 70" & vbCrLf
    LyrStrt = InStr(1, DXFInfo, LookFr)
    LyrStrt = LyrStrt + Len(LookFr)
    'get number of layers so we can add them back
    GetNumLyr = Trim(Mid(DXFInfo, LyrStrt, 6))
    LyrNum = Val(GetNumLyr)
    'add layers
    For mI = LBound(LyrNm, 1) To UBound(LyrNm, 1)
        LyrNum = LyrNum + 1
        LyrAddStr = LyrAddStr & "  0" & vbCrLf & "LAYER" & vbCrLf & "  2" & _
                    vbCrLf & LyrNm(mI) & vbCrLf & " 70" & vbCrLf & "     0" & _
                    vbCrLf & " 62" & vbCrLf & LyrClr(mI) & vbCrLf & _
                    "  6" & vbCrLf & "CONTIN" & vbCrLf
    LyrAddStr = Left(LyrAddStr, Len(LyrAddStr) - 2)
    'remake the file
    LyrStrt = InStr(1, DXFInfo, LookFr)
    LyrStrt = LyrStrt + Len(LookFr)
    DXFInfo = Left(DXFInfo, LyrStrt) & Space(6 - Len(CStr(LyrNum))) & CStr(LyrNum) & vbCrLf & LyrAddStr & Mid(DXFInfo, LyrStrt + 6)
    'write the file
    PutStrFile MyDXFFile, DXFInfo
End Sub
Public Sub PutStrFile(iFName As String, Info As String)
    Dim mFno As Long, mLen As Long
    mFno = FreeFile
    Open iFName For Output As #mFno
    Print #mFno, Info
    Close #mFno
End Sub

Open in new window

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tommy KinardCommented:
I wrote this to be used from excel, cut and paste the code in a module in excel and run the AddLayer macro. you will be given a dialog box in which to navigate to the folder and to the file you want to process. Please note that some modifications are required in the code to suit you needs.
DaxitAuthor Commented:
Hello Dragontooth

I do not know how to try it, I do not use microsoft office, only openoffice, which suffice enough for my needs. And in general I do not know how to use code like this with a spreadsheet.

Also my question is how can I recognize the geometries I want to give layer names in a text enviroment? Is your macro showing the drawings as selectable graphics?

Maybe I have to refine my question, I need a graphical editor to fast select elements and assign layer names for single elements or group of elements, so that when I import them as dxf file in biesseworks cam I will have the toolpaths ready to go.

The names of the paths tell the biessework how to mill the material.

Thank you anyway.

Tommy KinardCommented:
Not trying to be picky but: "I need it to convert dxf simple files into dxf files with layer names" does not say anywhere about a graphical interface to select objects to change to another layer.
This says "I do not need to modify anything, add anything or remove anything."

The code I posted was a macro that reads in a dxf file and adds layers and rewrites it, this is what I thought you wanted, this is what I posted.

Now that I actually know what you are requiring. OpenOffice has a graphical drawing program, can't you edit the dxf file with it? If not then you will need to purchase a copy of acad lt. You may be able to get a copy from e-bay for a used version or an education version maybe. Since you want to keep it at version 12 for the cam you should be able to get a copy cheap.

DaxitAuthor Commented:
Hello Dragonthoot

Thank you anyway, I was not really clear with my question I suppose.
Sorry for that. But you helped me to explain what I need. I am sure there must be a free or really cheap and easy editor to do it, I will try the openoffice draw program as you mentioned.

The problem is very clear to who works with cad software and biesseworks cam softwares, the need is to give layer names to geometrical entities in a dxf r12 drawing. It is a silly thing, but biessework won't understand what is what if layers names are not given properly, on the other side it will even rcognize tecnological info if names are given according to a biesse language.

Not all folks, I am the first among them, like acad, I personally don't at all, and I won't use it even for free.

Also I won't like to spend even a few coins on such a software expecially if my need is to just do a easy conversion and info adding as better explained now.

So I am sorry to have disappointed you. It I appreciated anyway your help, even though is not useful to me.

I did not know that draw from openoffice reads and writes dxf files, I will check out this to start with.

Thank you.

Tommy KinardCommented:
Not a problem you haven't disappointed me, I just though I had done what you had asked for.

We do plasma cutting here and we have to have holes on a different layer, piece marks on a different layer, and the "edge" on a different layer. So I understand what you are asking for now.

I found this one, I tested it and it works for version 12. http://www.a9tech.com/ for download

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seems as though you've imposed some artificial limitations on yourself which is going to make it hard to help you.

I'm assuming each shape needs a different layer. How do you propose selecting the possibly dozens of lines, arcs, etc of a given shape to assign to a particular layer?

 You mention CAD, what cad software are you using to generate the dxf files?
DaxitAuthor Commented:

Yes in fact there are limitations due to the kind of complex cuttings we do, with frequent tool change and different rpm and cutting speeds etc on the same workpiece, but entities will not be on different layer one by one, but in grops, for example all circles inside certain rectangles will be a x group receiving an x cutting sort, the rectangles will be in the y group and will be worked in another way, all drilling will be grouped according to the size and depth, and so on.

So I will need to make a named layer for each of this groups.

I will do collect elements accordingly to the capabilities of the program I will find for this annoying task.

The goal is to be able to send files that can be automatically imported and machined without need of setting anything on machines on which I do know the tools setup.

I am used to work in type3, and did not have the problem previously as I had the postprocessor to work directly with the old machine. Now things changed as there is a new machine, don't have the software upgrade yet nor a postprocessor other than the one within in biesseworks, and biesseworks is yet unknown and complicate for my taste, I don't want to loose time in doing simple things in a complicate way.

Furthermore the cad capabilities of this software are really limited to basic stuff and I find it "woody" if related to type edit.

That solution will allow me to give cutting programs to people who just know how to use the machine, but is not expert in deciding how to do things, will allow also to fast help from remote locations and will solve the complexity of biesse cam programming for faster operation.

That is why I look for a very simple tool with gui that helps in collecting entities and assign them to a named layer. Must be as easy as possible, very strightforward and fast.

I found out very interesting solution the acad clone pointed out by Dragonthooth, but being allergic to acad and not knowing it at all I have to understand how to use and see if it is a fast solution in assigning named layers to the entities.

I will ask some persons who know acad to show me haow to check if it is viable for me.

It is very very ineteresting cad though.

I found out also art-shop_x-lite, not revised yet, but someone told me that can do this.

Thank you.

DaxitAuthor Commented:
The software proposed by Dragontooth does exaclty what I asked for, it is free and without special limitations furthermore does much more too being a sort of autocad clone.
Thank you Dragontooth, your help is greatly appreciated.
Bye the way I also found by myself this easy software that is having different functions too, it is called cambam, it is free and might be useful for the same purpose plus can create toolpaths, it deserves to be mentioned too.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CAD/Architecture Software

From novice to tech pro — start learning today.