2 Attachment(s)
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)
)
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.
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
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.
1 Attachment(s)
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
Re: Joining polylines with PEDIT, fuzz distance issues
i didn't understand plz explain me
2 Attachment(s)
Re: Joining polylines with PEDIT, fuzz distance issues
Quote:
Originally Posted by
c.dodds344133
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.
Re: Joining polylines with PEDIT, fuzz distance issues
Quote:
Originally Posted by
jaberwok
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?
Re: Joining polylines with PEDIT, fuzz distance issues
Quote:
Originally Posted by
jaberwok
You can't join parallel lines like that. There must be a joining vector.
See images.
Quote:
Originally Posted by
irneb
+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
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 :roll:?