View Full Version : Offset line both sides at the same time
rstiles
2004-10-26, 03:02 PM
hi i have a problem and i need a lisp to help me out what the problem is i have a aerial images of a county and i am tracing roads with a centerline for an accurate map for a piping utility plan. what i need is some way of offsetting the center line to both side 25' for the right away i started making a button that make the command set the offset distance correct every time you click the button but then i have to select the line and the side to offset i want to just select the line and have it offset both sides 25' i tried multi lines but they don't do curves can anyone help me with the command
here is the command that i have come up with so far:
^C^C(COMMAND "OFFSET")(COMMAND "25")
-RUSS
mjfarrell
2004-10-26, 03:29 PM
Russ,
I know that this answer isn't lisp, just stay with me a minute.
If you have access to, or are using MAP just draw the centerlines
then later create an offset or buffer topology from them they will
not only be the right distance, but the layer properties will be correct as well.
If you have access to, or are using Land Desktop, just draw the centerlines,
define them as alignments, and then create the required offsets from those
centerlines.
rstiles
2004-10-26, 03:34 PM
i do not have access to those programs. i am forced to use for this project to use 2002 and raster design.
Mike.Perry
2004-10-26, 03:42 PM
Hi
Check out the following thread for a AutoLISP solution (as requested) -
Dbl Line Offset (http://forums.augi.com/showthread.php?t=3986)
Have a good one, Mike
CAB2k
2004-10-26, 03:47 PM
Do you know how to lisp?
Can you take it from here?
;; Double Offset Method - CAB 10/26/2004
;; offset to both sides a given distance
;; Arguments
;; ename is an entity name
;; dist is the offset distance
;; Returns
;; nil if failed or
;; list of the two new entities
;;
(defun OffsetDouble (ename dist / vobj enew)
(setq vobj (vlax-ename->vla-object ename)
enew '())
(if (vlax-method-applicable-p vobj 'Offset)
(progn
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vlax-invoke
(list vobj 'Offset dist)))
(prompt "\nPositive distance failed.")
(setq enew (list (entlast)))
)
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vlax-invoke
(list vobj 'Offset (- dist))))
(prompt "\nNegative distance failed.")
(setq enew (cons (entlast) enew))
)
)
(prompt "\nCannot offset selected object type.")
)
); defun
CAB2k
2004-10-26, 03:50 PM
Hi
Check out the following thread for a AutoLISP solution (as requested) -
Dbl Line Offset (http://forums.augi.com/showthread.php?t=3986)
Have a good one, Mike
Good one Mike, lot's of choices there.
CAB2k
2004-10-26, 04:12 PM
Here are some helper functions if you need them.
;; double offset helper
;; ask for distance only once
(defun c:dblo(/ ent ofd)
(initget (+ 1 2))
(setq ofd (getdist "\nEnter offset distance: "))
(while (setq ent (entsel "\nSelect object to offset or Enter to quit."))
(OffsetDouble (car ent) ofd)
)
)
;; double offset helper
;; ask for distance every time
(defun c:dblo2(/ ent ofd)
(while (setq ent (entsel "\nSelect object to offset or Enter to quit."))
(initget (+ 1 2))
(setq ofd (getdist "\nEnter offset distance: "))
(OffsetDouble (car ent) ofd)
)
)
;; double offset helper
;; preset offset distance
(defun c:dblo25(/ ent ofd)
(setq ofd (* 25 12.0)) ; to feet if you are working in inches
(while (setq ent (entsel "\nSelect object to offset or Enter to quit."))
(OffsetDouble (car ent) ofd)
)
)
whdjr
2004-10-26, 05:47 PM
Here's another one:
(defun ssnames (selection_set / num lst)
(repeat (setq num (sslength selection_set))
(setq num (1- num)
lst (cons (ssname selection_set num) lst)
)
)
lst
)
(defun c:ol (/ ss objlst dist)
(princ "\nSelect lines to offset: ")
(setq ss (ssget '((0 . "*LINE"))))
(if ss
(progn
(setq objlst (mapcar 'vlax-ename->vla-object (ssnames ss)))
(initget (+ 1 2 4 64))
(setq dist (getdist "\nEnter offset distance: "))
(initget (+ 2 4) "Yes No")
(setq kwrd (getkword "\nDelete original object [Yes/No] <Yes>: "))
(if (null kwrd)
(setq kwrd "Yes")
)
(foreach obj objlst
(vla-offset obj dist)
(vla-offset obj (* dist -1))
(if (eq kwrd "Yes")
(vla-erase obj)
)
)
)
)
(princ)
)
rstiles
2004-10-26, 05:52 PM
thank you i appretiate the help that was more than enough to help out this will make the job go much faster
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.