Author Topic: Copy Object along Feature Line  (Read 3735 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!
Copy Object along Feature Line
« on: July 23, 2015, 12:32:21 PM »
I did not know if someone already had a way to copy a block along a feature line or not? I have code that I usually use with polylines. The problem is I usually have to draw the feature line first and then redraw a polyline on top of it.

Code: [Select]
(defun c:CBFP (/ foo ss lst pt)
  (defun foo (p)
    (if (vl-consp p)
      (or (vl-member-if
            (function (lambda (a) (equal (list (car a) (cadr a)) (list (car p) (cadr p)))))
            plst
          )
          ((lambda (pnt) (foreach x lst (vla-move (vla-copy x) pt pnt)) (setq pLst (cons p pLst)))
            (vlax-3d-point p)
          )
      )
    )
  )

  (if (and (princ "\nSelect object(s) to copy: ")
           (setq lst ((lambda (i / ss e l)
                        (if (setq ss (ssget "_:L"))
                          (while (setq e (ssname ss (setq i (1+ i))))
                            (setq l (cons (vlax-ename->vla-object e) l))
                          )
                        )
                      )
                       -1
                     )
           )
           (setq pt ((lambda (p) (cond (p (vlax-3d-point (trans p 1 0)))))
                      (getpoint "\nSpecify base point: ")
                    )
           )
           (princ "\nSelect curves to copy object(s) along: ")
           (setq ss (ssget '((0 . "ARC,LINE,*POLYLINE,SPLINE"))))
      )
    ((lambda (i / e eLst p pLst)
       (while (setq e (ssname ss (setq i (1+ i))))
         (cond
           ((vl-position (cdr (assoc 0 (setq eLst (entget e)))) '("ARC" "LINE" "SPLINE"))
            (mapcar (function foo) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e)))
           )
           ((vl-position (cdr (assoc 0 eLst)) '("LWPOLYLINE" "POLYLINE"))
            (repeat (setq p (1+ (fix (vlax-curve-getEndParam e))))
              (foo (vlax-curve-getPointAtParam e (setq p (1- p))))
            )
           )
         )
       )
     )
      -1
    )
  )
  (princ)
)
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Copy Object along Feature Line
« Reply #1 on: July 23, 2015, 12:48:13 PM »
exploded feature lines become polylines
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Copy Object along Feature Line
« Reply #2 on: July 23, 2015, 12:49:16 PM »
and, what type of block are you copying?

could be a way to do this as alignment/assembly process
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Copy Object along Feature Line
« Reply #3 on: July 23, 2015, 01:00:01 PM »
Its just a surface spot block. I try to place one at all vertexes of the feature line quickly.
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Copy Object along Feature Line
« Reply #4 on: July 23, 2015, 02:10:16 PM »
use points...

along object, vertices


let the point style contain the block you want to place as the symbol
Be your Best


Michael Farrell
http://primeservicesglobal.com/

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Copy Object along Feature Line
« Reply #5 on: July 23, 2015, 02:35:45 PM »
I tend to use points for some labeling functions, as invariably someone later wants a stakeout list.
And points are the most direct way to get that task done.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Copy Object along Feature Line
« Reply #6 on: July 23, 2015, 03:22:20 PM »
We use the points on top of surfaces sometimes just to be able to project it to a profile.
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Copy Object along Feature Line
« Reply #7 on: July 23, 2015, 03:29:03 PM »
We use the points on top of surfaces sometimes just to be able to project it to a profile.
by point in this instance are you implying 'blocks'

it would also work with a point I believe

OR you could even try the transparent command 'SSE
Be your Best


Michael Farrell
http://primeservicesglobal.com/

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Copy Object along Feature Line
« Reply #8 on: July 23, 2015, 03:50:36 PM »
Nope, the block was to reference the "surface spot elevation" label.
Civil3D 2020