connecting users of the CorelDRAW family of products

DXF Import Generates a bunch of curves? How to weld all the nodes?

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 14 Replies | 3 Followers

Share  
Page 1 of 1 (15 items) | RSS

avayan posted on Sat, Feb 20 2010 18:29

Hi Corel Experts:

I have succesfully imported a DXF file into Corel Draw, but the result is 39,000 lines/curves. Per example, a box is not a box but four lines. Is there an easy way to have Corel Draw weld all the nodes so that I can grab and move the curves on a per curve? By the way, I do not want to GROUP the lines and curves into a single object since this is still the same as four lines/curves. This is a job to laser cut and is imperative it goes as a single curve, not a combination of curves.

That being said, combine will get the four lines/curves into a single curve, but the nodes are not welded. So I have to go node by node and place them on top of each other in order for the weld to take place. At 39000 curves, this is 78000 nodes. Eh, no thanks!

There has to be a way to open up a DXF file where the curves are unified into the objects they represent. What are your recommendations? Thanks!

JIQ

All Replies

Not Ranked
Kuala Lumpur, Malaysia
Male
Suggested by zoolkifli

Hello Avayan,

 

Assuming you use Autocad, try to export your CAD drawings in WMF format instead of DXF. I find DXF is rather messy when you import them from CorelDraw. Im not sure about them becomes automatically joint,but thats how i colour my CAD drawings in CorelDraw.

Otherwise, you just have to clean up and just group them together, create a different layer for colouring or whatever you want to do with your DXF drawings.

Good luck!

Zool.

Top 50 Contributor
ABBOTSFORD, BC CANADA
Male

 

This method would only work if you didn't have too many objects to "smart fill" (and outline at the same time as you smart fill... it's built in to the tool)

I did a search using Google and another search using the Search function... also had a look at the http://woxxom-macros.blogspot.com/ site
They have a sophisticated dxf generator that minimizes the number of nodes and generates connected curves for tool path generation.

Between them I stumbled upon a "smart fill" trick that worked in X3 for the most part and then altered the technique to suit the job.

1. Imported (using the Import feature in CDX3) the dxf
2. immediately made a duplicate and worked with the original moving the dupe off the page.
3. globally changed the line colour for the drawing to cyan. The weld command applied globally didn't do the weld as I expected it would do so...
4. then smart filled all the separate objects (it's a site plan of a Concrete/Gravel batching plant)
     used a light colour so I could see the hairline black outline I used as part of the smart fill.
     This puts a duplicate object(s) on top of the existing cyan separate lines dxf import drawing.
     Didn't take too long as I didn't have a horrendous amount of "objects" to smart fill with outline done automatically as I filled.

5.  Then I opened Object Manager and blew away (deleted) all the separate cyan outline curves.      I tried the Find & Replace function built into CDX3 but I never was able to execute through to the result I was looking for.   Likewise for a macro I have from http://www.macromonster.com    And because my file is probably simpler without as many objects as yours I brute forced my way through it.


6.  This left me with a page full of objects with objects all closed (lines/nodes connected where they should be) that I could globally unfill or change the outline width and colour and fill with whatever I wanted using  the  standard fill tools built in to CDX3... and indeed work with the objects anyway CDX3 allows.

Devil  the 'dd'

 

 

comin' atcha from up on the hill in Abbotsford, BC  CANADA

Top 200 Contributor
Orange County, California, USA
Male

Hi,

I am the author of the DXFTool (http://www.coreldrawtools.com) which is a CNC / Laser oriented DXF export.  I have been working on an import tool also.  If you would like to preview it please contact me through the contact form on my website.

-James Leonard

Top 50 Contributor
ABBOTSFORD, BC CANADA
Male

Cool. I'll go there now.

Devil  the 'dd'

comin' atcha from up on the hill in Abbotsford, BC  CANADA

Hi James,

I have seen your tool posted on a lot of places, so I am guessing it is a very nice tool. However, it seems (after reading the descriptions) that it does the opposite of what I need. Your tool takes my Corel Draw drawing and exports it as an awesome DXF I can then open up with my CAM software so that the proper tool path is computed.

My environment is the total opposite. I have a drawing that was generated on some CAD software (I don't even know which), and I use Corel Draw X3 as my CAM. Corel Draw sends the vector information to my laser engraver. This works gorgeously well, except that if I have a gazillion lines, the laser goes crazy and run whichever line the magnetic pole on planet Gensribinder choses. And unfortunately, it is rarely ever two contiguous lines.

As you can imagine, not only this makes the process ridiculously slow, it also works pretty bad. My biggest problem is that if I have a series of concentric curves, I need the inner curves to be cut before the outer curves. If the larger curves are cut first, the piece of material will fall out of focus, so the laser will literally ignite the material as the inner circles are being cut. This is a show stopper and unfortunately, the most common outcome.

I am amazed at how there is so much people asking for this rather simple solution, but there is none. A macro that took these steps would be the solution:

1. Combine all the lines into a single curve (This does not solve the problem, as it is in reality not a single curve. Each node is separate from contiguous nodes, when they should be a single node.)

2. Join every dual node. This sounds simpler than it truly is. When there are two nodes on top of each other, a join will work. But sometimes there are four nodes on top of each other (beats me why), and then some extra manual steps are needed.

Once I do this, the file runs flawlessly. Except that it takes hours to get there, when the file has thousands and thousands of lines!

I tried the Oberon solution, but I am not willing to pay $50 for something that still does not work. I think the problem is when it encounters four nodes, instead of two. And pressing reduce nodes will not work.

I wonder if Corel Draw X5 has a solution to this pesky problem... I do thank all that have offerred an answer, although at this time I have not found the ultimate solution. Anybody else? Thanks!

Hi Zool,

Thanks for your answer. I use Turbo CAD and tried the WMF export, but still the same problem occurred. Each square/curve is imported by Core Draw as a line. What seems to work is to do a combine of all the lines, and then manually (and painstakingly) join each node pair. If there are more than two nodes (I don't see why this happens, but it does!), then I have to delete extra nodes until I get only two, in which case I can do a Join.

This process is ridiculously tedious! Considering the large amount of people doing laser cutting, how is it possible that there is no easy tool to overcome this hassle? I am dying to see it out there!

Thanks for your suggestion, though.

Best regards,

JIQ

Top 10 Contributor
Pigeon Forge, TN
Male
TAG - gdgmacros.com

Seems like a custom macro could do the job easily.

Can you post a sample cdr file.

-John

"The best thing about learning is that it never stops, and the rabbit hole will go as deep as you let it."
~John
www.gdgmacros.com

A macro? I can imagine a macro would be the solution. I tried the simple record-execute-stop and play, but the macro I had recorded was always looking at the specific nodes I had selected while recording the macro. Kind of useless if you ask me. But it is most likely something I did wrong. I'll see if I can get a little bit more info on how to code my own macro to solve this problem. Thanks for the suggestion!

JIQ

Top 10 Contributor
Pigeon Forge, TN
Male
TAG - gdgmacros.com

No problem.

Here's one I posted a while back somewhere on one of these sites. It closes curves that are open.

It may atleast give you a starting point example. You may want to search for nodes that have the same x,y position and delete first. The macro recorder helps a little, but the real power is in loops and this is where the recorder can't help.

Sub closeThePaths()
    Dim i As Integer
    Dim p As Page
    Dim s As Shape, s1 As Shape
    Dim sr As ShapeRange
    Dim sr2 As New ShapeRange
   
    For Each p In ActiveDocument.Pages
        p.Activate
        Set sr = ActivePage.Shapes.All.BreakApartEx
        'Set sr = ActiveSelectionRange.BreakApartEx
        ActivePage.Shapes.All.UngroupAll
         For Each s In sr
             Set sr2 = s.BreakApartEx
             For Each s1 In sr2
                If s1.Curve.Closed = False Then
                    s1.Curve.Closed = True
                End If
             Next s1
             sr2.Combine
         Next s
    Next p
End Sub

 

-John

"The best thing about learning is that it never stops, and the rabbit hole will go as deep as you let it."
~John
www.gdgmacros.com

Top 10 Contributor
Pigeon Forge, TN
Male
TAG - gdgmacros.com

Also try this:

http://recentfiles.netfirms.com/

 

-John

"The best thing about learning is that it never stops, and the rabbit hole will go as deep as you let it."
~John
www.gdgmacros.com

OK, I installed the macro in my system and created the two buttons. One for RemoveUnderlyingDups and another for NodeClean2.

When I ran RemoveUnderlyingDups, the system told me it was going to delete 87 segments. It worked nicely!

Then I went ahead and selected the elements to do the joining, but the error below pops up:

 

I tried doing the combining first, doing with all the elemets separated, selecting just the two nodes in question, but either time the error came up. Any pointer as what is the needed procedure to make this work? Thanks! 

Top 200 Contributor
Orange County, California, USA
Male

Hi,

You misunderstood my offer.  I have a prototype tool that does what you need as far as the DXF import.  It is not published yet.  I was offering to collaborate with you.  I also have a new tool that reorganizes a CorelDRAW drawing for optimal motion that I have developed in collaboration with another laser cutter that I met here.  Contact me if you are interested in collaborating on what a new tool could do for laser cutters.

-James Leonard

Hi James,

Very sorry for my misunderstanding. Yes, I'll be glad to help you with the development of this tool!

Best regards,

JIQ

Top 200 Contributor
Orange County, California, USA
Male

Hi,

Ok, please contact me through my website so we can trade emails.  I have decided to add the DXF import to the DXFTool Professional Edition since I have recently added color support to that.  I now support the AutoCAD Color Index RGB values but I want to have a .CSV format file that I can import and make into a CorelDRAW palette.  That way, laser cutters that are using CorelDRAW as their CAM program can specify absolute RGB values for their laser operations that originate in an external program and are loaded into CorelDRAW as a DXF file.  This upgrade of the Professional Edition will also include an API so you can call my DXF functionality directly from a VBA program of your own.

-James Leonard

 

Page 1 of 1 (15 items) | RSS
© Corel Corporation. The content herein is in the form of a personal web log ("Blog") or forum posting. As such, the views expressed in this site are those of the participants and do not necessarily reflect the views of Corel Corporation, or its affiliates and their respective officers, directors, employees and agents. Terms and Conditions / User Guidelines.