Jump to content

Recommended Posts

Posted
  On 9/8/2018 at 4:29 PM, drdownload18 said:

I'm still getting same error :(

Expand  

 

 

Re: My last and taking into account Tharwat's post that line should be :

 

(entmake '((0 . "POLYLINE") (70 . 8)))

 

  • 4 years later...
Posted
  On 2/15/2015 at 12:35 PM, Lee Mac said:

Welcome to CADTutor Alex :)

 

Below is a rough draft of a possible program, but the code should hopefully perform as required:

 

(defun c:poly23dpoly ( / enx idx lst pll ptl sel )
   (princ "\nSelect points & 2d polylines: ")
   (if (setq sel (ssget '((0 . "LWPOLYLINE,POINT"))))
       (progn
           (repeat (setq idx (sslength sel))
               (setq enx (entget (ssname sel (setq idx (1- idx)))))
               (if (= "POINT" (cdr (assoc 0 enx)))
                   (setq ptl (cons (cdr (assoc 10 enx)) ptl))
                   (setq pll (cons (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) enx)) pll))
               )
           )
           (foreach grp pll
               (foreach vtx grp
                   (if (setq vtx (car (vl-member-if '(lambda ( a ) (equal vtx (list (car a) (cadr a)) 1e-4)) ptl)))
                       (setq lst (cons vtx lst))
                   )
               )
               (if (cdr lst)
                   (progn
                       (entmake '((0 . "POLYLINE") (70 . ))
                       (foreach vtx lst
                           (entmake
                               (list
                                  '(00 . "VERTEX")
                                  '(70 . 32)
                                   (cons 10 vtx)
                               )
                           )
                       )
                       (entmake '((0 . "SEQEND")))
                   )
               )
               (setq lst nil)
           )
       )
   )
   (princ)
)
 

 

Expand  

Dear Lee Mac,

i have been using this lisp , and now when i load it get e message,

; error: extra right paren on input
what could be the reason please,

Posted

you need to add another ) on the end.

 

(defun c:poly23dpoly (/ enx idx lst pll ptl sel)
  (princ "\nSelect points & 2d polylines: ")
  (if (setq sel (ssget '((0 . "LWPOLYLINE,POINT"))))
    (progn
      (repeat (setq idx (sslength sel))
        (setq enx (entget (ssname sel (setq idx (1- idx)))))
        (if (= "POINT" (cdr (assoc 0 enx)))
          (setq ptl (cons (cdr (assoc 10 enx)) ptl))
          (setq pll (cons (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) enx)) pll))
        )          ;end repeat
      )            ;end progn
      (foreach grp pll
        (foreach vtx grp
          (if (setq vtx (car (vl-member-if '(lambda (a) (equal vtx (list (car a) (cadr a)) 1e-4)) ptl)))
            (setq lst (cons vtx lst))
          )
        )          ;end foreach
        (if (cdr lst)
          (progn
            (entmake '((0 . "POLYLINE") (70 .))
              (foreach vtx lst
                (entmake (list
                           '(00 . "VERTEX")
                           '(70 . 32)
                           (cons 10 vtx)
                         )
                )
              )    ;end foreach
              (entmake '((0 . "SEQEND")))
            )
          )        ;end progn
          (setq lst nil)
        )          ;end if
      )            ;end foreach
    )              ;end progn
  )                ;end if
  (princ)
)                  ;end defun

 

Posted
  On 9/28/2022 at 9:33 AM, CADWORKER said:

Dear Lee Mac,

i have been using this lisp , and now when i load it get e message,

; error: extra right paren on input
what could be the reason please,

Expand  

 

The 'upgrade' to the forum software a few years ago caused every occurrence of "8)" within code blocks to be removed rendering many thousands of code posts unusable; I've now updated my earlier post to reinstate the missing characters.

  • Like 2
  • Agree 1
  • 2 weeks later...
Posted

Hello, I've tried the lisp, but it creates a 3dpolyline between the given points.

for example 4 points makes a 3 segment 3dpoly....

how can i get the interpolated height at every vertex?

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...