Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Options

Import DXF with points joined?

henry_feldmanhenry_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.

Best Answers

Answers

  • Options
    jacob_luetkemeyerjacob_luetkemeyer Member Posts: 8
    I'm having the same issue with my DXF files and I haven't found a solution yet. This should be high priority considering anyone wanting to use Onshape probably has legacy DXF files.
  • Options
    brian_bradybrian_brady Member, Developers Posts: 505 EDU
    In the sketch where you imported the DXF, click and drag a vertex away from its current position and then back to a point where the other vertex becomes highlighted as coincident and let go of the mouse button. You will see that the two points are now locked together. Repeat as necessary.
  • Options
    henry_feldmanhenry_feldman Member Posts: 126 EDU
    Repeat as necessary.
    Yes, it was the "n" of points that was making me less than thrilled for this...
  • Options
    brian_bradybrian_brady Member, Developers Posts: 505 EDU
    Repeat as necessary.
    Yes, it was the "n" of points that was making me less than thrilled for this...
    Yeah, and this case had a fairly small number of points. I like 3dcad's idea.
  • Options
    mlml Member Posts: 53 PRO
    edited September 2016
    it is a totally basic problem and i can't believe sometimes that it still exists. the most modern tools and options are worth nothing, if people are not are able to bring in their existing old school dxf files.

    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
    capability was added by Ilya Baran after i promised to leave him alone if he exposed the functionality. All i did was make it work the way i wanted it to!
    may the force be with us. a simple fs would bring so much.

  • Options
    3dcad3dcad Member, OS Professional, Mentor Posts: 2,470 PRO
    What do yo think @dave_cowden ?

    It would surely be worth some $$ for people who import a lot of dxf/dwg to find open joints and fix them..
    //rami
  • Options
    mlml Member Posts: 53 PRO
    edited September 2016
    @3dcad we still have had contact with @dave_cowden , he does great work

    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  
    We see ourselves as a “helping customers make amazing products” company. 

    still believe that this are only teething troubles and will be adressed

  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    Hi, guys!

    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.


  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    @ml can you share the document you started? If you're not interested in proceeding, i could take a look and see if i can develop it further...
  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    thanks! yeah I see what you're doing here.. Let me see what I can come up with. 
  • Options
    philip_thomasphilip_thomas Member, Moderator, Onshape Employees, Developers Posts: 1,381
    ml said:


    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
    capability was added by Ilya Baran after i promised to leave him alone if he exposed the functionality. All i did was make it work the way i wanted it to!
    may the force be with us. a simple fs would bring so much.

    @ml - Sorry, @ilya_baran is off the hook on this one - there is nothing to expose! This is new code that doesn't yet exist. I suggest submitting an enhancement request. :)

    Philip Thomas - Onshape
  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    hey all, just an update:

    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.  
  • Options
    3dcad3dcad Member, OS Professional, Mentor Posts: 2,470 PRO
    It would be certainly great to have 'heal' button in sketch which would automatically join endpoints and trim intersections with given tolerance. I have seen this function in other cads and sometimes they even worked as planned.

    @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..

    //rami
  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    edited September 2016
    Hey, everyone: good news. I have knocked together a FeatureScript that might help.

    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.
  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    ok, Ilya as always replied very quickly-- there is currently no way to allow a feature that generates sketches to behave as a built-in sketch, so I wont be able to fix that problem.

    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.
  • Options
    mlml Member Posts: 53 PRO
    @dave_cowden wow I am impressed, you are a true ambassoder (even if not on the payroll)! they should offer you a pro account for free or hire you. as a free user you made the work for them....

    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...?

  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    edited September 2016
    Hey, @ml thanks for the kind words!

    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.
  • Options
    dave_cowdendave_cowden Member, Developers Posts: 470 ✭✭✭
    Answer ✓
    @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.
  • Options
    robert_stilesrobert_stiles Member Posts: 92 PRO
    This is an old thread, and some interesting featurescripts here, but has Onshape made a native way of solving this is in 7 years? Typically, dxf geometry is fixed (or not ours to mess with) and its just the position we need to move. is there a better work flow for a dxf you don't want to mess with, but you do want its position to change?
  • Options
    burger_hattinghburger_hattingh Member Posts: 2
    Also curious if there's a native fix. Also, thanks for the work @dave_cowden
  • Options
    daniel_brennan124daniel_brennan124 Member Posts: 2
    im also here to find a modern solution to this problem
Sign In or Register to comment.