Author Topic: Offset command similar  (Read 3665 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Offset command similar
« on: August 15, 2014, 10:57:52 AM »
Just curious if there is a way that I can perform an offset, then pick the beginning point then the end point and it will offset every 9 feet or so. I know this is probly a no brainer, ... just cant think of the command to do this. thxs
Civil3D 2020

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Offset command similar
« Reply #1 on: August 15, 2014, 11:01:35 AM »
Are you aware of the "Through" option in offset or maybe the array command? It's hard to tell exactly what you're aiming for. from your description. Maybe a sketch will help you explain.
CAD Tech

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Offset command similar
« Reply #2 on: August 15, 2014, 11:05:04 AM »
Ok. I was not aware. Thanks for pointing that out, but still not getting it to do what I want...
Civil3D 2020

Rob...

  • King Gator
  • Posts: 3824
  • Take a little time to stop and smell the roses.
Re: Offset command similar
« Reply #3 on: August 15, 2014, 11:06:49 AM »
Then please refer to the rest of my response.
CAD Tech

Bethrine

  • Guest
Re: Offset command similar
« Reply #4 on: August 15, 2014, 11:43:25 AM »
Array should be perfect for that...? Or maybe we do need a sketch?  :-)

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Offset command similar
« Reply #5 on: August 15, 2014, 11:50:24 AM »
Best example I can come up with is the following:

Parking Stalls,

being able to select an object. tell it I want it to offset 9 feet from the point of begging to the end. It will offset in between.

I need to look at the measure tool and array...
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Offset command similar
« Reply #6 on: August 15, 2014, 12:04:44 PM »
Best example I can come up with is the following:

Parking Stalls,

being able to select an object. tell it I want it to offset 9 feet from the point of begging to the end. It will offset in between.

I need to look at the measure tool and array...

There are parking stalls as dynamic blocks that will do what you are after on the tool palette
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Hangman

  • Swamp Rat
  • Posts: 566
Re: Offset command similar
« Reply #7 on: August 15, 2014, 12:23:46 PM »
Best example I can come up with is the following:

Parking Stalls,

being able to select an object. tell it I want it to offset 9 feet from the point of begging to the end. It will offset in between.

I need to look at the measure tool and array...

Yes, there's an app for that!    :-P

If you need the end to be the same distance as the beginning, using array is where you want to go.
If you don't care what the end result is, simply copy; 9', 18', 27', ...
If you need specific measurements between the beginning and end, draw a line from beginning to end, set your Point Style to something other than a point or blank (so you can see/access the nodes), divide the line by the amount of spaces you need (not the count of lines between the spaces, but the spaces themselves), draw your line/object & copy from node to node (not so quick & dirty but it works easily enough).
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Offset command similar
« Reply #8 on: August 26, 2014, 11:39:42 AM »
I've reached the age where the happy hour is a nap. (░┐░)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Offset command similar
« Reply #9 on: August 26, 2014, 11:49:27 AM »
I use this to offset most anything but trusses in plan view is what I use it for the most.
It now uses one of Lee's older Vector Offset routines. See the two functions at the very end to call the routine from the command line.


Code: [Select]
;;  ArrayObjects is a modified from of Lee Mac  Array on Vector
;;  This engine allowed me to replace several of my stand
;;  alone lisp routines, now I have a versatile offset routine.
;; 
;;  http://www.theswamp.org/index.php?topic=44596.msg498546#msg498546
;;  http://lee-mac.com/incrementalarray.html
(defun ArrayObjects
               (ss  ; selection set to copy
                p0  ; base point of array
                ortho_on ; vector constraints 0 90 180 270
                dx  ; distance between copies
                / ss->list copyv dx gr nx obs obx pd vx dis last#)
  (vl-load-com)
  (defun ss->lst (ss / i ename lst)
    (setq i -1)
    (while (setq ename (ssname ss (setq i (1+ i))))
      (setq lst (cons (vlax-ename->vla-object ename) lst))
    )
    lst
  )
 
  (defun copyv (ob  ;  objects list
                n   ;  number of copies
                v   ;  vector direction
                / i b l)
    (setq i 1
          b (vlax-3d-point '(0. 0. 0.))
    )
    (repeat n
      (foreach obj ob ; step through object list
        ;; note the the new object is created at the location of the original object
        ;;   the move is a relative move based on base point zero & offset vectors
        (vla-move ; each object copied
          (car ; move newest of the new object
            (setq l ; create a list of new objects
                      (cons (vla-copy obj) ; new object
                             l)))
                  b  ; base move point 0,0,0
                  (vlax-3d-point ; destination of move
                    (mapcar '* v (list i i i)))
        )
      )
      (setq i (1+ i))
    )
    l ; return the list of new objects
  )
 
  (if
    (and
      (setq obs (ss->lst ss))
      (setq pw (trans p0 1 0))
      (not (equal dx 0.0 1e-14))
    )
 
     (while (= 5 (car (setq gr (grread 't 13 0))))
       (redraw)
       (setq obx (car (mapcar 'vla-delete obx))
             px  (cadr gr))

       ;;  vextor is p0->px
       (cond
         (ortho_on ;  only use x or y axis which ever is greator
          (setq dis (mapcar '- px p0)) ; get x & y distance
          (if (> (abs(car dis))(abs(cadr dis)))
            (setq dis (car dis)  ; x axis
                  nx   (fix (/ dis dx))
                  vx   (trans (list (if (minusp dis) (- dx) dx) 0. 0.) 1 0)
                  px   (trans (list (car px) (cadr p0)(caddr px)) 1 0)
                  )
            (setq dis (cadr dis) ; y axis
                  nx   (fix (/ dis dx))
                  vx   (trans (list 0. (if (minusp dis) (- dx) dx) 0.) 1 0)
                  px   (trans (list (car p0) (cadr px)(caddr px)) 1 0)
                  )
          )
         
         )
         (t ; any angle
           (setq vx (trans (polar '(0. 0. 0.) (angle p0 px) dx) 1 0)
                 nx (fix (/ (distance p0 px) dx)) ; calc number of copies to array
           )
         )
       )

       (setq obx (copyv obs (abs nx) vx))
       (grvecs (list -3 p0 (trans px 0 1)))
       ;|(print p0)(princ " -> ")(princ px)|;
       (if (null last#) (setq last# (1+ (abs nx))))
       (if (/= (1+ (abs nx)) last#)
         (progn
           (setq last# (1+ (abs nx)))
           (princ "\nArray count = ")
           (princ last#)
         )
       )
     )
  )
  (redraw)
  (princ)
)


;;; TrussOffset.lsp
;;;
;;; Author: Copyrightę 2005 Charles Alan Butler
;;; Version:  1.0 May. 23, 2004
;;; Version:  1.1 Jul. 22, 2004
;;; Version:  2.0 Mar. 08, 2013 - abondoned my array & used Lee's Array function
;;; Purpose: offset objects user offset distance to fill selected area
;;;          Flag for X & Y directions only.
;;;          Will work with any objects
;;;
;;; [Prompts]
;;; Select objects
;;; Enter or select offset distance
;;; Pick start & end point of array distance, these picks only establish
;;;  direction and total distance, not start & end points.
;;;
(defun TrussArray (ortho_on ; t = use angles 0 90 180 270 only
                   / *error* p1 p2 ss dist num tmp)
  ;;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; if
    (and useros (setvar "osmode" useros))
    (and usercmd (setvar "CMDECHO" usercmd))
    (princ)
  ) ;;end error function


  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq useros (getvar "osmode"))
  (setvar "orthomode" 1)

  (prompt "\nSelect objects to offset")
  (if (setq ss (ssget))
    (progn
      (if (null to_step); global var
        (setq to_step 24)
        (setq to_step (abs to_step))
      )
      (setq tmp (getdist (strcat "\nEnter or pick offset amount. <"(rtos to_step) "> ")))
      (if tmp
        (setq to_step (abs tmp))
      )
     
      (if (setq p1 (getpoint "Pick Starting point"))
         (ArrayObjects ss p1 ortho_on to_step)
      )
    )
  ) ; endif
  ;;==========  Exit Sequence  ============
  (*ERROR* "")
  (princ); Exit quietly
) ; end defun

(defun c:trussoucs ()
  (TrussArray nil) ; any angle
  (princ)
)
(defun c:trusso ()
  (TrussArray t) ; t = use angles 0 90 180 270 only
  (princ)
)
I've reached the age where the happy hour is a nap. (░┐░)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Offset command similar
« Reply #10 on: August 26, 2014, 12:17:42 PM »
Thanks for sharing CAB.
Civil3D 2020