I'm trying to Offset a line with OD data, but it blows the data away as I expected.
So, what I'm looking for is a Lisp or Macro that Offsets the selected line/polyline a set distance, then copies the OD data from the source line/polyline to the new one, then deletes the source line/polyline.
I've been doing this manually using the Copy_OD lisp, but am trying to speed up my workflow and create less possible points of human error.
Thank you in advance
where are the offset distances stored? and what determines the direction of the offset?
The net effect is to move the line a certain distance? Why the offset, copy the OD and then delete?
The distance isn't stored anywhere; it would have to be a user input or a defined distance in the lisp. I have a shape file with varying information in different lines along a single route all stacked on top of one another and I need to clean them up by offsetting the lines so they are not overlapping while still retaining the OD data. I want it to delete the source line so I can then move on to the next line that would be underneath that one. Also, I would like it to be deleted so I don't accidentally have two lines with the same OD data/feature ID.
you have a shape file, as in .shp, .prj. shx, etc? or autocad lines with OD?
can you post a sample of a "stack" of lines?
Hi @jkingAPGMT
Your explanation clearly describes what you're trying to achieve, however, suggesting how forum participants should proceed is not conducive to reaching final solution.
Without looking thoroughly through your data, you may (or may not) be able to use a Join, Overlay Analysis, Bulk Copy or Map Import & Export. Uploading your shapefiles is more valuable than exploring the feasibility of Autolisp that performs offset and delete while combining all the existing data attributes.
The forum is full of those willing to share their know-how. All forum users, both newbie and oldie, gain insight that improves productivity and enhances their drawing experience. It's a free education.
Specify your starting point, where you'd like to end up and the reason for going. The forum will gladly take you there.
Pictures and uploaded data are always welcomed.
Chicagolooper
You can try this code
(vl-load-com)
(defun c:Offset&OD ( / ss ent lst_data tbldef lst_data mark next n nw_ent ct)
(while
(not
(setq
ss
(ssget "_+.:E:S"
'((-4 . "<OR")
(-4 . "<AND")
(0 . "POLYLINE")
(-4 . "<NOT")
(-4 . "&") (70 . 112)
(-4 . "NOT>")
(-4 . "AND>")
(0 . "LWPOLYLINE,LINE,SPLINE,ARC,CIRCLE,ELLIPSE")
(-4 . "OR>"))
)
)
)
)
(setq ent (ssname ss 0) lst_data nil)
(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
(foreach n (ade_odgettables ent)
(setq tbldef (ade_odtabledefn n))
(setq lst_data
(cons
(mapcar
'(lambda (fld / tmp_rec numrec)
(setq numrec (ade_odrecordqty ent n))
(cons
n
(while (not (zerop numrec))
(setq numrec (1- numrec))
(if (zerop numrec)
(if tmp_rec
(cons fld (list (cons (ade_odgetfield ent n fld numrec) tmp_rec)))
(cons fld (ade_odgetfield ent n fld numrec))
)
(setq tmp_rec (cons (ade_odgetfield ent n fld numrec) tmp_rec))
)
)
)
)
(mapcar 'cdar (cdaddr tbldef))
)
lst_data
)
)
)
)
(setq lst_data nil)
)
(setq mark (entlast))
(command "_.offset")
(while (not (zerop (getvar "CMDACTIVE"))) (command pause))
(if (and mark (entget mark))
(progn
(setq
ss nil
ss (ssadd)
)
(while
(setq next (entnext mark))
(ssadd next ss)
(setq mark next)
)
ss
)
)
(cond
(ss
(repeat (setq n (sslength ss))
(setq nwent (ssname ss (setq n (1- n))))
(cond
(lst_data
(mapcar
'(lambda (x / ct)
(while (< (ade_odrecordqty nwent (caar x)) (ade_odrecordqty ent (caar x)))
(ade_odaddrecord nwent (caar x))
)
(foreach el (mapcar 'cdr x)
(if (listp (cdr el))
(progn
(setq ct -1)
(mapcar
'(lambda (y / )
(ade_odsetfield nwent (caar x) (car el) (setq ct (1+ ct)) y)
)
(cadr el)
)
)
(ade_odsetfield nwent (caar x) (car el) 0 (cdr el))
)
)
)
lst_data
)
)
)
)
(entdel ent)
)
)
(prin1)
)
Can't find what you're looking for? Ask the community or share your knowledge.