Jump to content

Recommended Posts

Posted

Lee Mac: Thanks but that only seems to connect with a 2D Polyline. I was looking for a 3D polyline to connect points with varying z values.

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    29

  • Lee Mac

    12

  • stevesfr

    11

  • Demesne

    6

Top Posters In This Topic

Posted Images

Posted
It is a 3dPolyline. When you list a 2d or 3dpolyline, it will just say 'Polyline'.

 

Ahhh! I see.

Posted

My ride is late...

 

 

(defun c:OC (/ _sel lst pt line)
 ;; Connect objects (by insertion point)
 ;; Alan J. Thompson, 05.22.10
 (vl-load-com)
 (defun _sel (pnt msg / gr e pt)
   (while (and (setq gr (grread T 15 2))
               (/= (car gr) 25)
               (not (vl-position (cadr gr) '(13 158)))
               (not e)
          )
     (redraw)
     (and pnt (grdraw (trans pnt 0 1) (cadr gr) 1 -1))
     (princ (strcat "\r" msg))
     (if (and (eq 3 (car gr))
              (setq e (ssget (cadr gr)))
              (setq e (entget (ssname e 0)))
              (not (wcmatch (cdr (assoc 0 e)) "*LINE*,ARC,*TEXT*"))
              (setq pt (cdr (assoc 10 e)))
         )
       pt
       (setq e nil)
     )
   )
 )

 (if (car (setq lst (list (_sel nil "Select object: "))))
   (while (setq pt (_sel (car lst) "Select next object: "))
     (if (equal pt (car lst))
       (alert "Same object as previous!")
       (if line
         (vla-put-coordinates
           line
           (AT:PointList->Array (apply (function append) (reverse (setq lst (cons pt lst)))))
         )
         (setq line (vla-Add3DPoly
                      (AT:ActiveSpace)
                      (AT:PointList->Array
                        (apply (function append) (reverse (setq lst (cons pt lst))))
                      )
                    )
         )
       )
     )
   )
 )
 (redraw)
 (princ)
)

(defun AT:PointList->Array (lst)
 ;; Convert point list (must be appended first) to array
 ;; Alan J. Thompson, 09.16.09
 (if (vl-consp lst)
   (vlax-Make-Variant
     (vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbDouble (cons 0 (- (length lst) 1))) lst)
   )
 )
)


(defun AT:ActiveSpace (/)
 ;; Defined ActiveSpace
 ;; Alan J. Thompson, 10.12.09
 (if (or (eq acmodelspace
             (vla-get-activespace
               (cond (*AcadDoc*)
                     ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
               )
             )
         )
         (eq :vlax-true (vla-get-mspace *AcadDoc*))
     )
   (vla-get-modelspace *AcadDoc*)
   (vla-get-paperspace *AcadDoc*)
 )
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...