Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Joining polylines with PEDIT, fuzz distance issues

  1. #1
    Member
    Join Date
    2012-11
    Posts
    4
    Login to Give a bone
    0

    Default Joining polylines with PEDIT, fuzz distance issues

    Hi,

    I am trying to join some polylines together and am having issues where I set the fuzz distance, but the line segments added are far greater than what I have specified. I am using Civil 3D 2013 but have verified the same behaviour on Autocad 2013.

    I have attached a small file and a lisp routine which will show the strange behaviour. On running the lisp, you can see that a line segment of length >2 is added even though fuzz distance is set to 0.2.

    Any clues as to what is happening?

    Cheers,
    Chris

    Code:
    (defun c:fuzzWhat (/ oldSnap ss)
    
        ;Turn off snaps
        (setq oldSnap(getvar "osmode"))
        (setvar "osmode" 0)
    
        ;Select all lines & Join with pedit fuzz 0.2
        (if (setq ss (ssget "_X" (list (cons 0 "LINE"))))
            (command "pedit" "m" ss "" "y" "j" "j" "a" 0.2 "")
        )
    
        ;Turn snaps back on
        (setvar "osmode" oldSnap)
    )
    Attached Files Attached Files

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,655
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Try this routine, it joins lines arcs and polylines. Selecting one joins all lines connected and selecting all should do what you need.
    Code:
     ;;; PLJOIN.LSP 2011 Version
    ;;; Joins lines, arcs and polylines
    ;;; If only one object is selected it joins to all conected objects
    ;;; By Tom Beauford
    ;;; BeaufordT@LeonCountyFL.gov
    ;;; Macro   ^C^C^P(or C:pljoin (load "pljoin.lsp"));pljoin
    
    (defun c:pljoin (/ cmdecho peditaccept ss)
      (princ "\nSelect object to join: ")
      (setq cmdecho (getvar "cmdecho")
            peditaccept (getvar "peditaccept")
            ss (ssget '((0 . "LINE,ARC,*POLYLINE")))
      )
      (setvar "cmdecho" 0)
      (setvar "peditaccept" 1)
      (if ss
          (progn
    	(if (= (sslength ss) 1)
              (command "_.pedit" ss "_J" "_all" "" "")
              (command "_.pedit" "_M" ss "" "_J" "0.0" "")
    	)
          )
      )
      (setvar "cmdecho" cmdecho)
      (setvar "peditaccept" peditaccept)
      (princ)
    )
    Change the fuzz distance to whatever fits your needs.

  3. #3
    Member
    Join Date
    2012-11
    Posts
    4
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Hi Tom,

    Thanks for your help. I am experiencing the same issue with your code. I think the problem must be in the drawing rather than the code. If I make a new drawing from scratch, then both your code and my code behave as I would expect, however I am working with a drawing which has been created by another program and so I don't know if something weird is happening to the file before I get it.

    Cheers,
    Chris

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,655
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Still running 2012 here, couldn't open your demo3.dwg. A regular polyline can only have one elevation for all it's points. Try running the Express Tool FLATTEN on the lines before trying to join them. Depending on the coordinate system you're using large elevations can cause a shift when flattening because of the projection. Both of our routines simply use command script, so if you can't join two lines using the pedit command these routines will not do it either. Test pedit on a few lines and if it doesn't work list them. Extrusion direction would cause problems as well.

  5. #5
    Member
    Join Date
    2012-11
    Posts
    4
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Hi Tom,

    Thanks again. Flatten worked! I can't figure out why though, as the start Z and end Z values were 0 for all the lines. Also as you mentioned I did see a shift when flattening. How do I prevent this? I have attached a 2010 version of the file, so that might give you some more info as to what is wrong with it.

    Thanks for your help.
    Cheers,
    Chris
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    2012-12
    Location
    U.A.E
    Posts
    3
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    i didn't understand plz explain me

  7. #7
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Quote Originally Posted by c.dodds344133 View Post
    Hi Tom,

    Thanks again. Flatten worked! I can't figure out why though, as the start Z and end Z values were 0 for all the lines. Also as you mentioned I did see a shift when flattening. How do I prevent this? I have attached a 2010 version of the file, so that might give you some more info as to what is wrong with it.

    Thanks for your help.
    Cheers,
    Chris
    You can't join parallel lines like that. There must be a joining vector.
    See images.
    Attached Images Attached Images

  8. #8
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Quote Originally Posted by jaberwok View Post
    You can't join parallel lines like that. There must be a joining vector.
    +1. If you'd want it to "automatically" close those lines would you want it to work like fillet would? I.e. close the ends using semi-circles?

  9. #9
    Member
    Join Date
    2012-11
    Posts
    4
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Quote Originally Posted by jaberwok View Post
    You can't join parallel lines like that. There must be a joining vector.
    See images.
    Quote Originally Posted by irneb View Post
    +1. If you'd want it to "automatically" close those lines would you want it to work like fillet would? I.e. close the ends using semi-circles?
    not true. This is only the case if you chose the "extend" option when joining polylines. If you chose the "add" or "both" options you can join parallel lines.

    I just want a straight line between the ends, not a semi circle. If I create a new file from scratch it works fine. It also works fine if I flatten the file I get from the other program, but the lines are slightly shifted as mentioned by Tom.

    Cheers,
    Chris

  10. #10
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Joining polylines with PEDIT, fuzz distance issues

    Thanks, that actually showed me something re the join.

    Anyhow, yes those z values do cause trouble don't they? I generally set my OSSANPZ = 1 (Options dialog / Drafting tab / Replace Z value with current elevation) when working on 2d drawings - due to this problem. Doesn't solve existing problems (for that use flatten), but it attempts to avoid future trouble.

    I find it happening very often when referring to others' drawings. I'd expect it from civil DWG's, but why does it ALWAYS happen with interiors dwgs ?

Page 1 of 2 12 LastLast

Similar Threads

  1. Reverse Polylines with Pedit
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 10
    Last Post: 2012-07-18, 03:55 AM
  2. joining 3d polylines
    By Davied2 in forum AutoCAD 3D (2006 or below)
    Replies: 6
    Last Post: 2009-10-15, 09:31 PM
  3. Joining polylines
    By tom.scott in forum AutoCAD General
    Replies: 8
    Last Post: 2009-10-01, 05:08 PM
  4. Selecting only Polylines with pedit
    By Zuke in forum AutoLISP
    Replies: 4
    Last Post: 2008-08-14, 11:00 PM
  5. Problems with PEdit when joining some Lines together
    By ross.wakley in forum AutoCAD LT - General
    Replies: 8
    Last Post: 2006-02-06, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •