-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement DXF Importing #17
Comments
Comment by dcowden Added a starting point. I have a whole zip file of all of the american steel shapes, and all of the 8020 shapes once we get this going! |
Comment by RustyVermeer I have started poking around with the code in the DXF branch. The following is a rough start at this only, of course.
What I've done in the above code is:
I'm running into a problem with the 1515-ULS.dxf test file though. That is the resulting step file opened in SolidWorks. It's missing the 2 end faces. Without the center hole, things work as expected: I am unsure how to solve this issue. Does FreeCAD or CQ have a notion of wire orientation? Or perhaps I am just misusing available functions in CQ? Has this problem been addressed somehow in the extrude functions? |
Comment by dcowden that's a great start. I think your approach is good. sortWiresByBuildOrder should return the outerwire first, but for extrusion i dont think it matters. I think i see the problem. in the example, the inner contour doesnt look like its closed. The upper-right of the 'star' appears to be missing: That could be an issue where the last contour is not being closed or whatever? |
Comment by RustyVermeer Sort order does matter, actually. At least, it does for this particular case. Leaving sort with outer wire later in the list produces (the 'default' output of that function):
And reversing the sort (with the center 'star' thing filtered out just for this example): As for your suggestion about a missing contour: There is no contour error there. I doubly confirmed that it's not open by extruding ONLY that star center, and it worked correctly: Not sure how to tackle this particular issue. Any insights or ideas of where to look next? Despite this, it's possible to make a workplane() function that imports DXF and creates wires on the stack, so I'll go forward with that, anyway. |
Comment by dcowden Ah i see ok. Well, this is a really really great first try. I'm I'm pretty sure it doesnt have anything to do with your code-- the solution It appears that when i wrote this, i may have even known this is an issue-- Assume: FreeCAD should be smart enough to nest wires inside each other and figure To test this theory, I would recommend reversing the order of the edges in On Tue, Nov 28, 2017 at 8:55 PM, Jeremy Wright notifications@github.com
|
Comment by easyw Hi @dcowden @jmwright @RustyVermeer |
Comment by dcowden ...oh except I'd rather not import openscad code to solve it... Perhaps we can use the same approach but realized using the embedded occ code. I think occ has a function that organizes edges as well |
Comment by dcowden @easyw @RustyVermeer ShapeAnalysisWire and ShapeAnalysisWireOrder are the ones I had in mind: https://www.opencascade.com/doc/occt-7.0.0/refman/html/class_shape_analysis___wire.html These would fix the problem if it is related to edge ordering. I am not sure they would fix the issue if they are related to wire nesting issues, however. One other strategy might be to look at the FreeCAD code and see what they do when you extrude a drawing. I suspect that this case would work fine if the objects were imported into a sketch and then the sketch was extrude, so they solve it somehow.... |
Comment by dcowden Here is a starting point to get into what's going on in OCC land: https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/FeatureExtrusion.cpp In this code you can begin to see the limitations of using OCC. Note on this line how FreeCAD folks have applied a work around to use a copy to work around a problem extruding circles: https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/FeatureExtrusion.cpp#L260 It looks like they have a dedicated class to make an extrudable face out of wires: https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/FeatureExtrusion.cpp#L304 https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/App/FaceMaker.cpp |
Comment by RustyVermeer Hmm... looks like quite the rabbit hole :) I learned something else, recently while trying your suggestion to change the order of edges. If I reverse the edge list order, nothing changes and the issue still occurs. What is still strange to me, though, is that the other 4 internal wires (at the corners) worked without switching start/end vertices. And I checked if the start of one edge aligns with the end of the other. They all do, by default. So, I cannot simply compare one edge's start to the next edge's end, as that doesn't necessarily indicate that 'flipping' the edge is necessary. |
Comment by adam-urbanczyk @dcowden @RustyVermeer @easyw here is an example of sorting wires using OCC: Maybe you could give it a try? @RustyVermeer can you export this model as a BREP file? It sounds like there is something wrong with the edges orientation |
Comment by RustyVermeer @adam-urbanczyk I'm not sure exactly what you'd like? Is there a brep export directly in CQ, or do you want me to save the STEP files from Solidworks out to their wireframe modes? I recently pushed some changes to the dxf_branch. I appear to have broken some things, unfortunately (still new to most of this stuff). After cloning to my VPS and fiddling a bit, I was able to get the current dxf function to work as expected. Essentially I do a check for clockwise or counter clockwise orientations of the edges, and then force all to be CCW. This has so far proven to work for all of the dxf files I've tried. There's still a good chance this isn't perfect, though. |
Comment by dcowden @adam-urbanczyk do you want a bunch more DXFs to try? And, what are your thoughts about how we can bundle common profiles with CQ? I have this huge library of standard ANSI sections ( steel tubes, i beams, etc). Seems a shame not to bundle them all into CQ with a cool function that will generate those sections automatically by name But then again maybe that's best done as a separate module ( plugin ) |
Comment by RustyVermeer I know you asked the other Adam... but I hope I can still answer too :) I think the dxf import makes sense as part of the CQ core functionality. Regardless of that, it might be useful to have them all for testing purposes on my end. Could you help me out with that, @dcowden ? |
Comment by dcowden Sorry about that-- I meant you but input from all Adams is great. Tonight i'll make a big zipfile of them all and post them somewhere for you. |
Comment by easyw may I have those too? 😄 |
Comment by dcowden @easyw @adam-urbanczyk @RustyVermeer @jmwright |
Comment by RustyVermeer Would your idea be as simple as creating a github repo full of dxf files and calling it a day? |
Comment by dcowden @RustyVermeer @easyw @adam-urbanczyk @jmwright |
Comment by adam-urbanczyk @RustyVermeer You can import/export a .brep file using CQ (both in FreeCAD and OCC backends), which is an OCC-specific lossless format. That is what I meant. @dcowden Yeah would be nice to have those bundled with CQ. BTW: do you know https://github.com/jreinhardt/BOLTS ? |
@RustyVermeer what is the status of the DXF branch? IS it worth trying to integrate it into CQ2.0? |
@RustyVermeer I'd be also interested in the status - can I/someone be of any help? |
@dumblob I haven't seen @RustyVermeer on GitHub for a long time, and his activity graph doesn't show anything for over a year. All the DXF import work was done only on the CQ 1.0 (FreeCAD based) repo. I think it's probably safe if you wanted to start working on this issue on your own. Here's the relevant branch and a relevant directory from CQ 1.0, but since it was written to run on top of FreeCAD, I'm not sure how much of it you'd be able to re-use. The readme in the directory gives some background on what Rusty was doing. |
I'll apologize up front for my silence and inactivity. To get directly to it: This is not something I have maintained, nor is it something I have the ability to work on. @jmwright is correct to point out that things have advanced quite a bit beyond my work, and I can't say how well this will mesh with the latest work. A bit of honesty: Stewardship of open source work is (as I'm learning) critically important, and I've failed on that front. Edit: didn't finish a sentence... |
@RustyVermeer take it easy. Even if unfinished, your work is greatly appreciated! |
@RustyVermeer Thanks for all your contributions. Don't beat yourself up about it. |
@RustyVermeer no disappointment on my side. It's totally normal and an inevitable part of open source work to approach it rather "dynamically" when it comes to personal life and priorities 😉. Cheer up and don't be ashamed. Great work you've done. |
Thanks for the support everyone. I am glad to know that there's value in the work :) I do hope that CadQuery can continue to grow and gain interest, it's certainly a great project! |
I wonder if something like this https://github.com/mozman/ezdxf could be integrated |
@greyltc Wow, that's a really interesting option. Thanks for posting it. |
BTW this is what @RustyVermeer was trying to integrate. If you want to pick this up @greyltc we'll definitely merge it. |
Oh! Woops! I didn't realize his work was ezdxf based. |
If anyone is interested I added some preliminary dxf importing capabilities to the OCD-dxf branch (https://github.com/CadQuery/cadquery/tree/OCP-dxf). Feedback is welcome! |
super cool! This is a huge deal, IMO-- there are a ton of programs that can
create dxf, this is great!
…On Sun, May 10, 2020 at 2:37 PM Adam Urbańczyk ***@***.***> wrote:
If anyone is interested I added some preliminary dxf importing
capabilities to the OCD-dxf branch (
https://github.com/CadQuery/cadquery/tree/OCP-dxf). Feedback is welcome!
[image: obraz]
<https://user-images.githubusercontent.com/13981538/81507465-e552a000-92fd-11ea-8079-8a00ecc19daf.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ44A7WSBPYR4VYLN4S3GLRQ3X7VANCNFSM4GIWPZ7A>
.
|
Solved by #372 |
Issue by dcowden
Sunday Dec 11, 2016 at 22:02 GMT
Originally opened as dcowden/cadquery#173
Created from issue #155
The text was updated successfully, but these errors were encountered: