AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Polyline join error

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Anonymous
1007 Views, 9 Replies

Polyline join error

In the past when I joined two polylines, the resulting polyline picked up all the attributes of the first one, including any attached Object Data. We recently upgraded to AutoCAD Map 3D 2019, and I've just noticed that now, when I join two polylines, the end result has all the Object Data stripped out. Is there a setting in the background that is doing this? How can I get back to how it ought to work?

Thanks

9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

After further experimentation, and working with colleagues, we've discovered that this only applies with 2D polylines, not normal polylines. This seems odd, and is irritating, since whenever you use the Drawing Clean up tool, it creates 2D polylines. You then have to filter and convert to normal polylines before you can do any joining.

I'm sure this never used to happen, so why now? Is there an easier way around it?

Message 3 of 10
АлексЮстасу
in reply to: Anonymous

Maybe it will help:

1. Try setting PLINETYPE to 2.
2. Convert 2DPolyline to Polyline (lwpolyline) _CONVERTPOLY. OD when converting saved.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 4 of 10
Anonymous
in reply to: АлексЮстасу

Hi Alexander,

I'm afraid I don't get that. When I try to use the CONVERTPOLY command, it asks if i want light or heavy, but which ever I choose it doesn't convert anything.

Am I missing something?

Message 5 of 10
АлексЮстасу
in reply to: Anonymous

_CONVERTPOLY from 2dpolyline to the usual polyline (lwpolyline) - option "light".

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 6 of 10
CADaSchtroumpf
in reply to: Anonymous

Hi,

 

You can try this!

Converting polyline2D to lwpolyline, but keep the xdata or object data (for map or civil) if present.

 

(defun c:MY_Convert ( / js i ent dxf_obj xd_l l_10 l_40 l_41 l_42 dxf_39 e_next dxf_next dxf_43 dxf_38 lst_data nwent tbldef)
	(initget "Toutes Selection _All Select")
	(if (eq (getkword "\nPolylignes 2D a optimiser ? [Toutes/Selection] <Selection> : ") "All")
		(setq js (ssget "_X" '((0 . "POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 120) (-4 . "NOT>"))) i -1)
		(setq js (ssget '((0 . "POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 120) (-4 . "NOT>"))) i -1)
	)
	(cond
		(js
			(repeat (sslength js)
				(setq dxf_obj (entget (setq ent (ssname js (setq i (1+ i)))) (list "*")) l_10 nil l_40 nil l_41 nil l_42 nil
					xd_l (assoc -3 dxf_obj)
				)
				(if (cdr (assoc 39 dxf_obj))
					(setq dxf_39 (cdr (assoc 39 dxf_obj)))
					(setq dxf_39 0.0)
				)
				(setq e_next (entnext (cdar dxf_obj)))
				(while (= "VERTEX" (cdr (assoc 0 (setq dxf_next (entget e_next)))))
					(if (zerop (boole 1 (cdr (assoc 70 dxf_next)) 16))
						(setq
							l_10 (cons (cdr (assoc 10 dxf_next)) l_10)
							l_40 (cons (cdr (assoc 40 dxf_next)) l_40)
							l_41 (cons (cdr (assoc 41 dxf_next)) l_41)
							l_42 (cons (cdr (assoc 42 dxf_next)) l_42)
						)
					)
					(setq e_next (entnext e_next))
				)
				(setq
					l_10 (reverse l_10)
					l_40 (reverse l_40)
					l_41 (reverse l_41)
					l_42 (mapcar '(lambda (x) (cons 42 x)) (reverse l_42))
				)
				(if (and (equal (apply 'max l_40) (apply 'min l_40)) (equal (apply 'max l_41) (apply 'min l_41)))
					(setq dxf_43 (car l_40) l_40 nil l_41 nil)
					(setq
						dxf_43 nil
						l_40 (mapcar '(lambda (x) (cons 40 x)) l_40)
						l_41 (mapcar '(lambda (x) (cons 41 x)) l_41)
					)
				)
				(if (not (zerop (caddar l_10)))
					(setq dxf_38 (caddar l_10))
					(setq dxf_38 0.0)
				)
				(setq l_10 (mapcar '(lambda (x) (cons 10 (list (car x) (cadr x)))) l_10))
				(entmake
					(append
						(list
							(cons 0 "LWPOLYLINE")
							(cons 100 "AcDbEntity")
							(assoc 67 dxf_obj)
							(assoc 410 dxf_obj)
							(assoc 8 dxf_obj)
							(if (assoc 62 dxf_obj) (assoc 62 dxf_obj) (cons 62 256))
							(if (assoc 6 dxf_obj) (assoc 6 dxf_obj) (cons 6 "BYLAYER"))
							(if (assoc 370 dxf_obj) (assoc 370 dxf_obj) (cons 370 -1))
							(cons 100 "AcDbPolyline")
							(cons 90 (length l_10))
							(cons 70
								(if (zerop (boole 1 (rem (cdr (assoc 70 dxf_obj)) 128) 1))
									(boole 1 (cdr (assoc 70 dxf_obj)) 128)
									(1+ (boole 1 (cdr (assoc 70 dxf_obj)) 128))
								)
							)
							(cons 38 dxf_38)
							(cons 39 dxf_39)
						)
						(if (and l_40 l_41)
							(apply 'append
								(mapcar
									'(lambda (x10 x40 x41 x42)
										(append (list x10 x40 x41 x42))
									)
									l_10 l_40 l_41 l_42
								)
							)
							(progn
								(cons 43 dxf_43)
								(apply 'append
									(mapcar
										'(lambda (x10 x42)
											(list x10 x42)
										)
										l_10 l_42
									)
								)
							)
						)
						(list (assoc 210 dxf_obj))
						(if xd_l (list xd_l) '())
					)
				)
				(if
					(or
						(numberp (vl-string-search "Map 3D" (vla-get-caption (vlax-get-acad-object))))
						(numberp (vl-string-search "Civil 3D" (vla-get-caption (vlax-get-acad-object))))
					)
					(progn
						(setq lst_data nil nwent (entlast))
						(foreach n (ade_odgettables ent)
							(setq tbldef (ade_odtabledefn n))
							(setq lst_data (cons (mapcar '(lambda (fld) (cons n (cons fld (ade_odgetfield ent n fld 0)))) (mapcar 'cdar (cdr (nth 2 tbldef)))) lst_data))
						)
						(cond
							(lst_data
								(mapcar '(lambda (x) (ade_odaddrecord nwent (caar x)) (foreach el x (ade_odsetfield nwent (car el) (cadr el) 0 (cddr el)))) lst_data)
							)
						)
					)
				)
				(entdel ent)
			)
		)
	)
	(princ "\n") (princ (itoa (1+ i))) (princ " Polylignes converties en LWPolylignes ")
	(prin1) 
)
Message 7 of 10
Anonymous
in reply to: CADaSchtroumpf

Hi there,

Apologies for the delayed response, but I've been away.

I'm afraid I'm not used to using LISPs or macros, or whatever this is. How do I run it?

Thanks

Simon

Message 8 of 10
Peter2_1
in reply to: Anonymous

How to run an AutoLisp Program: http://lee-mac.com/runlisp.html

 

 

AutoCAD Map 3D 2023 German / Oracle
Message 9 of 10
Anonymous
in reply to: Peter2_1

Hi there,

Thanks for that. I've realised that since everything we produce ends up in the corporate GIS, a simpler solution is to export the file to a shp and re-import it. This automatically creates polylines (sometimes Lines, but these convert using the basic tools), maintains all the attached data and as an added bonus attaches data to everything, even if a NULL return.

Thanks anyway, as it's something I'll bear in mind in future with other LISP routines.

Cheers

Message 10 of 10
АлексЮстасу
in reply to: Anonymous

I do not understand why you can’t do it with CONVERTPOLY - it works in all versions of AutoCAD, the OD is completely preserved:

Command: PLINETYPE
Enter new value for PLINETYPE <0>: 2
Command:
Command: *Cancel*
Command: _CONVERTPOLY
Enter polyline conversion option [Heavy/Light] <Light>:
Select objects: Specify opposite corner: 2 found
Select objects:
2 polyline objects converted.

In my opinion, export-import, etc. lisp, etc. - clearly redundant, if you can use the usual command.


Maybe after the choice of <Light> you didn’t select the polylines themselves or didn’t specify the "p" - if there was a preliminary choice?

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


AutoCAD Beta