Jump to content

Need Lip For Converting Points to 3D Lines (Parallel to Z-Axis)


pvsvprasad

Recommended Posts

Dear seniors,

 

i have some points in my drawing. these selected points only should be developed as lines parallel to Z axis (i.e 3D) with specified length (example:3000mm).

 

please find sample drawings before 3d lines and after 3d lines. please share suitable lisp program to develop 3d Lines.

 

 

Thank you,

Best Regards.

Before 3d.dwg

After 3d.dwg

Link to comment
Share on other sites

(defun c:3dlinesIIZaxis ( / ss d i p p0 pz )
 (if
   (and
     (not (prompt "\nSelect points..."))
     (setq ss (ssget '((0 . "POINT"))))
     (not (initget 1))
     (setq d (getdist "\nPick or specify vertical distance from 0.0 elevation of selected points : "))
   )
   (repeat (setq i (sslength ss))
     (setq p (ssname ss (setq i (1- i))))
     (setq p0 (cdr (assoc 10 (entget p))))
     (setq p0 (append (reverse (cdr (reverse p0))) (list 0.0)))
     (setq pz (append (reverse (cdr (reverse p0))) (list d)))
     (entmake
       (list
         '(0 . "LINE")
         '(100 . "AcDbEntity")
         '(100 . "AcDbLine")
         (cons 10 p0)
         (cons 11 pz)
       )
     )
   )
 )
 (princ)
)

M.R.

Edited by marko_ribar
trans removed as Roy's catch...
Link to comment
Share on other sites

Still not 100% sure what OP requested, but perhaps line not from elevation of 0.0 but from points that may be in 3D...

 

(defun c:3dlinesIIZaxis ( / ss d c i p p0 z pz )
 (if
   (and
     (not (prompt "\nSelect points..."))
     (setq ss (ssget "_:L" '((0 . "POINT"))))
     (not (initget 7))
     (setq d (getdist "\nPick or specify vertical distance from selected points - absolute positive value : "))
     (progn
       (initget "Yes No")
       (setq c (getkword "\nNegative sign of distance [Yes/No] <No> : "))
       (if (null c)
         (setq c "No")
       )
       t
     )
     (progn
       (if (= c "Yes")
         (setq d (- d))
       )
       t
     )
   )
   (repeat (setq i (sslength ss))
     (setq p (ssname ss (setq i (1- i))))
     (setq p0 (cdr (assoc 10 (entget p))))
     (setq z (last p0))
     (setq pz (append (reverse (cdr (reverse p0))) (list (+ z d))))
     (entmake
       (list
         '(0 . "LINE")
         '(100 . "AcDbEntity")
         '(100 . "AcDbLine")
         (cons 10 p0)
         (cons 11 pz)
       )
     )
     (entdel p)
   )
 )
 (princ)
)

M.R.

 

BTW. Thanks Roy for the catch...

Edited by marko_ribar
modified - added (entdel p) and "_:L" ssget filter - applicable only for points on unlocked layer(s) so that (entdel p) work
Link to comment
Share on other sites

Still not 100% sure what OP requested, but perhaps line not from elevation of 0.0 but from points that may be in 3D...

 

M.R.

 

BTW. Thanks Roy for the catch...

 

Dear Sir,

Your code is perfectly working. i need small modification in your code. after developing lines, points should be erased which is selected (points) for lines developing. kindly modify.

 

Thanking you,

Best regads.

Link to comment
Share on other sites

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