Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Import DXF with points joined?
henry_feldman
Member Posts: 126 EDU
I am importing this dxf file for a part for my laser scanner which cracked (it was originally laser cut, and I am going to 3D print it, so need to change it from 2D->3D), which imports fine, and I can extrude it quite nicely by importing it into a sketch and extruding. However, the vertices are not constrained together (i.e. I can grab any vertex point and drag it away from the path).
So question one is how can a non-closed path be extruded? That seems weird (it's just a bag of lines that might not form watertight geometry, although they happen to be overlapping in this case).
Question two, is am I doing this wrong? I need to dimension off this and slightly change some dimensions in the sketch, and while I am aware I can painfully constrain each point pair to be coincident, in reality it is really hard to do this without changing dimensions.
I guess question 3 is there a way to drag over 2 vertices and constrain them as coincident without selecting their adjacent lines? In illustrator I could select just the points in my drag, but OS seems to have no such ability.
So question one is how can a non-closed path be extruded? That seems weird (it's just a bag of lines that might not form watertight geometry, although they happen to be overlapping in this case).
Question two, is am I doing this wrong? I need to dimension off this and slightly change some dimensions in the sketch, and while I am aware I can painfully constrain each point pair to be coincident, in reality it is really hard to do this without changing dimensions.
I guess question 3 is there a way to drag over 2 vertices and constrain them as coincident without selecting their adjacent lines? In illustrator I could select just the points in my drag, but OS seems to have no such ability.
Tagged:
1
Best Answers
-
3dcad Member, OS Professional, Mentor Posts: 2,475 PROThis has been discussed earlier and we have raised request for 'possibility to box select points and add coinincident constraint'. This would make it a lot easier to fix imported geometries.
//rami5 -
dave_cowden Member, Developers Posts: 475 ✭✭✭@henry_feldman Can you see if this Featurescript addresses your issue with less pain?
https://cad.onshape.com/documents/57cd717c2adf32107b41220d/w/9b855d135025e1f4dd43e9c7/e/8b12dd216ff65689ccfe0258
Just select your sketch, and use 'Fix DXF'. Then, hide the old sketch, select all of the entities generated by the feature, and it should extrude.1
Answers
have had same issues with dxf imports and points that are not coincident:
https://forum.onshape.com/discussion/comment/20176/#Comment_20176
https://forum.onshape.com/discussion/comment/19252/#Comment_19252
https://forum.onshape.com/discussion/comment/19900/#Comment_19900
i've started a featurescript to select an area and check for every point is there another one inside 0.000001mm and set them coincident then. with the update in august (https://forum.onshape.com/discussion/comment/20187/#Comment_20187 ) it seemed fixed for me. so i let the script beside - the hope of success wasn't big anyway...
i guess, a talented coder with the knowledge of fs and the dependencies has the solution in a few hours: https://www.onshape.com/cad-blog/featurescript-its-so-easy-an-engineer-can-do-it
we only can request @philip_thomas to repeat his visit at @ilya_baran as stated here in the first paragraph: https://forum.onshape.com/discussion/4604/3d-spline-with-tangency-and-weighting-control
It would surely be worth some $$ for people who import a lot of dxf/dwg to find open joints and fix them..
but, the big question is: why to pay extra for a basic function? if you rent or lease a car, do you have to search and pay a third party for listen correctly on the build in device the compact discs you bring with?
it can't be the precondition, that everyone who wants use OS has to start from scratch or gample around with legacy files that every company older three months simply have.
please remember the mission statement: https://www.onshape.com/careers
still believe that this are only teething troubles and will be adressed
I have created a solution to this problem, but sadly it is not a Featurescript. Solving this problem 'correctly' was something that Featurescript just cannot handle well.
When I created 8020 profile generator, I needed to import several hundred DXFs from 8020, and many of them would not extrude in Onshape.
The core reason turned out to be whether the DXF uses centerpoint arcs or whether it uses LPOLYLINEs to represent all arcs as 'bulges'. The LPOLYLINE format specifies arcs using the endpoints, thus preventing rounding problems when imported. DXFs that use centerpoint arcs and lines ( even modern ones ) will have problems extruding in Onshape.
Of course there are other problems too. The most common are entities in different layers, intersecting entities, and entities that are not part of a loop ( commonly, center marks, text, dimension lines on the model layer).
I ended up creating a python script that parses one or more DXFs, and produces a FeatureScript feature that will sketch and extruding all of the profiles. In fact, the 8020 profile generator was completely auto-generated
I initially started with a Featurescript, but solving this problem required the use of some advanced network graph libraries (networkX) so that i could reliably detect dangling entities and loops. I don't like coding in FeatureScript enough to try to build a graph library!
If people are interested, I can work on making this useful to the community. I think the best I could do would be to create a web-based tool that lets you upload a DXF, and it would give you back the source code for a FeatureScript that will reliably draw a sketch or extrude the profile. It works really well for my case, when I needed to import literally thousands of DXFs. Even if Onshape import worked flawlessly I'd need to automate it anyway.
If I only needed to import one drawing, I'm afraid I agree with @ml. The only reasonable solution is for Onshape to provide this functionality built in. Even if it were possible to create a FeatureScript, it would add another step to an already cumbersome import process.
I'm open to suggestions. Just let me know what would be useful! I'm sure there's a clever approach I've not thought of yet.
https://cad.onshape.com/documents/150b4b8582755bae310054ab/w/e7f86ea4d976b93e892239e1/e/59c574a50cc8741683921a96
I spent a bit investigating this morning. Short version, solving this problem with a FeatureScript is not as easy as it sounds.
Once a sketch is completed, you cannot add things or modify it afterwards. This is by design in Onshape, according to Ilya. The rationale is that regenerating the feature tree can result in circular behavior if the children can mutate the parent. Consequently, there is no way to allow a user to select items on a sketch, and then modify that sketch in any way-- including adding constraints.
This leaves one other possibility: we can make a copy of the sketch, and then modify the copy. This is not as easy, but it is possible, so I'm going to investigate that strategy next.
@dave_cowden has good grip on mass imports but Onshape should take care of single sketch healing. Maybe that healing code could be manipulated then using FS to build mass import function.
Personally I don't like to use multiple steps (first run this script, then add this code to here, then go back and... aargh) that is for coders not for designers and especially not for entrepreneurs who do some design work along with running the company..
This FeatureScript ( shared by @ml (thanks) ), has a dsub sketch that is broken-- the points do not exactly match up. When you try to extrude it, only the circles work:
The document includes a "Fix DXF" FeatureScript that will fix the sketch. Here it is in action. A new sketch is generated that extrudes correctly:
This is just a very fast prototype-- just had a couple of hours. Known limitations:
* Only supports lines, arcs, and circles. I can add splines later if people find this helpful
* Does not remove dangling/non-loops for you ( like center marks and such). I can add this later too, but for now i'll see if this is helpful first
* Not extensively tested! I just tested a few examples, and it seems to work ok.
* Onshape does not seem to recognize sketches created in a FeatureScript as a first class citizen. IE, when you extrude, you can't select the "Fix DXF" feature in the feature tree, you have to manually select all the entities you want to extrude with the mouse. I have posted a question about that here
Please try it out and see if it helps you.
If you guys get a chance to test this, let me know-- I'll add what's necessary if I can to make it useful.
I knew there is a way with fs in a few hours.
You made a copy of the entities of the sketch on the same sketch, or? that is also the reason why the circles will be extruded twice...?
Yes, the code makes a copy of the old sketch. This is necessary because in Onshape sketches earlier in the feature tree are immutable from within FeatureScript by design. To change things, new entities must be created.
I suspect the circles extruded twice because perhaps you selected both the new sketch ( which is a corrected copy of the old one ) and the old one-- thus extruding the circles twice. In my test, I hid the old sketch,selected all of the entities on the new sketch, and then extruded it. The fact that you have to manually select the entities on the new feature, rather than just picking it from the feature tree is also an Onshape limitation I cannot work around.
I'll be happy to make improvements to this if I can, just let me know. Sadly, the issues you reported are really not in my control to fix.
https://cad.onshape.com/documents/57cd717c2adf32107b41220d/w/9b855d135025e1f4dd43e9c7/e/8b12dd216ff65689ccfe0258
Just select your sketch, and use 'Fix DXF'. Then, hide the old sketch, select all of the entities generated by the feature, and it should extrude.