TheSwamp

CAD Forums => CAD General => Topic started by: ronjonp on May 24, 2004, 11:13:26 AM

Title: Offset to elevation in increments
Post by: ronjonp on May 24, 2004, 11:13:26 AM
Does anyone know of a lisp that would allow me to set an elevation increment so that when I am offsetting a pline it would offset to elevation 1, then elevation 2 and so on.....

thanks,

Ron :D
Title: Offset to elevation in increments
Post by: Dommy2Hotty on May 24, 2004, 11:30:38 AM
If I'm reading correctly, you want to offset a line the exact same increment multiple times, without having to select each new offset line, as you would in the normal offset command?

If so, the "Extended Offset" lisp in the Express menu is what you would want...

You specify the distance, select the line to offset (or pline in your case), then "M" for multiple, and select the side to offset to, and keep clicking for each one...They will offset the specified distance from the previously offset one....

Hope I'm on the right track...if not, that might help someone else...:twisted:
Title: Offset to elevation in increments
Post by: ronjonp on May 24, 2004, 12:24:50 PM
I want the plines that are being offset, to offset to different elevations. Preferably in an increment that can be predetermined.
Title: Offset to elevation in increments
Post by: Dent Cermak on May 24, 2004, 01:02:28 PM
So this would be real similar to the "creatae a curb" routine under 3d polylines, grading in the earthworks package ?
Title: Offset to elevation in increments
Post by: ronjonp on May 24, 2004, 03:24:10 PM
Quote
So this would be real similar to the "creatae a curb" routine under 3d polylines, grading in the earthworks package ?


What is earthworks package?
Title: Offset to elevation in increments
Post by: Slim© on May 24, 2004, 03:45:24 PM
It's a portion of LDD (Land Development Desktop).
Next question, do you have it?

I've also noticed that you have recommended http://www.DotSoft.com. products, their ToolPac Utilities has a 3D poly offset
Title: Offset to elevation in increments
Post by: CAB on May 24, 2004, 04:57:23 PM
Maybe this will work for you.
Hot off the press.. :)

Code: [Select]
;;;  Offset3d.lsp by Charles Alan Butler
;;;         Copyright 2004
;;;  by Precision Drafting & Design All Rights Reserved.
;;;  Contact at ab2draft@TampaBay.rr.com
;;;
;;;   Version 1.0 Alpha  May 24,2004
;;;
;;; DESCRIPTION
;;;  Offset routine just like ACAD Offset But with a Z value prompt
;;;  The z value is added to the existing z-value
;;;
;;;
;;;  Limitations
;;;  3d offset works only with LINES LWPlines or POLYLINEs
;;;
;;;
;;; Command Line Usage
;;; Command: Offset3d
;;;          Enter the Z offset distance.
;;;          Specify offset distance or [Through]
;;;          Select object to offset or <exit>:
;;;          Specify point on side to offset:
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;                                                                    ;
;;;  You are hereby granted permission to use, copy and modify this    ;
;;;  software without charge, provided you do so exclusively for       ;
;;;  your own use or for use by others in your organization in the     ;
;;;  performance of their normal duties, and provided further that     ;
;;;  the above copyright notice appears in all copies and both that    ;
;;;  copyright notice and the limited warranty and restricted rights   ;
;;;  notice appear in all supporting documentation.                    ;

(defun c:offset3d (/ ent dist prvdist pt loop etype oplist nplist crz
                   vrt elist ename newz zdist usercmd useros )
;;;===================================================================
;;;                        Local Functions                            
;;;===================================================================
  (defun offset ()
    (if (member etype '("LINE" "POLYLINE"))
      (progn
        (setq oplist (assoc 10 elist)
              crz    (cadddr oplist)
              crz    (+ crz zdist)
              nplist nil
              nplist (reverse (append (list crz) (cdr (reverse oplist))))
              elist  (subst nplist oplist elist)
        )
        (entmod elist)
      )
    )

    (cond
      ((= etype "LINE")
       (setq oplist (assoc 11 elist)
             crz    (cadddr oplist)
             crz    (+ crz zdist)
             nplist nil
             nplist (reverse (append (list crz) (cdr (reverse oplist))))
             elist  (subst nplist oplist elist)
       )
       (entmod elist)
      )
      ((= etype "POLYLINE")
       (setq vrt ename)
       (while (not (equal (cdr (assoc 0 (entget vrt))) "SEQEND"))
         (setq elist (entget (entnext vrt)))
         (setq crz (cadddr (assoc 10 elist)))
         (if (and crz (/= zdist 0))
           (progn
             (setq crz    (+ crz zdist)
                   oplist (assoc 10 elist)
                   nplist nil
                   nplist (reverse (append (list crz) (cdr (reverse oplist))))
                   elist  (subst nplist oplist elist)
             )
             (entmod elist)
             (entupd ename)
           )
         )
         (setq vrt (cdr (assoc -1 elist)))
       )
      )

      ((member etype '("LWPOLYLINE"))
       (setq newz  (+ (cdr (assoc 38 elist)) zdist)
             elist (subst (cons 38 newz) (assoc 38 elist) elist)
       )
       (entmod elist)
      )

    )
  )

;;;===================================================================;
;;; Author: John Kaul                                                 ;
;;;===================================================================;
  (defun setosnaps (value)
    (cond
      ((= value 1)
       (if
         (>= (getvar "osmode") 15359)
          (setvar "osmode" (boole 6 (getvar "osmode") 16384))
       )
      )
      ((= value 0)
       (if
         (<= (getvar "osmode") 15359)
          (setvar "osmode" (boole 6 (getvar "osmode") 16384))
       )
      )
    )
    (princ)
  )

;;;===================================================================
;;;                     Start of Routine                              
;;;===================================================================
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "osmode" 175)
  (if (null (setq zdist (getreal "\nEnter the Z offset distance.")))
    (setq zdist 0) ; default to zero
  )
  (setq prvdist (getvar "offsetdist"))
  (if (setq dist (getdist
                   (strcat "\nSpecify offset distance or [Through] <"
                           (rtos prvdist 4)
                           ">:"
                   )
                 )
      )
    dist
    (setq dist prvdist)
  )

  (setosnaps 0) ; disable osnaps
  (setq loop t)
  (while loop

    (while
      (and (null (setq ent (entsel "\nSelect object to offset or <exit>:")))
           (= (getvar "errno") 7)
      )
       (prompt "\nMissed, Try again.")
    )

    (if (and ent
             (setq pt (getpoint "\nSpecify point on side to offset:"))
        )
      (progn
        (command "_.Offset" dist ent pt "")
        (setq ename (entlast)
              elist (entget ename) ;entity data list
              etype (cdr (assoc 0 elist)) ;entity type
        )
        (if (member etype '("LINE" "LWPOLYLINE" "POLYLINE"))
          (if (/= zdist 0)
            (offset)
          )
          (alert "\nObject type not allowed, Z not changed.")
        )
      )
      (setq loop nil) ; done
    )
  ) ;_ end while
  (setvar "CMDECHO" usercmd)
  (setvar "osmode" useros)
  (princ)
) ;_ end defun

;;;   End Of File

Title: Offset to elevation in increments
Post by: Slim© on May 24, 2004, 05:20:53 PM
Very nice CAB, now all we need is for it to offest 3d polys. :D
Title: Offset to elevation in increments
Post by: ronjonp on May 24, 2004, 05:53:51 PM
Thanks CAB  :D  How would this be modifed so that the Z coordinate could be a negative value?

Thanks again.

 :D
Title: Offset to elevation in increments
Post by: CAB on May 24, 2004, 06:03:43 PM
When it asks for  the z offset enter a neg value. 8)

CAB
Title: Offset to elevation in increments
Post by: ronjonp on May 24, 2004, 06:07:12 PM
I didn't work the first time I tried it! :oops:  :oops: You're a ninja!! :D
Title: Offset to elevation in increments
Post by: CAB on May 24, 2004, 09:15:36 PM
Your  welcome....

CAB