Jump to content

Recommended Posts

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • souvik

    9

  • GP_

    6

  • eldon

    5

  • ReMark

    3

Top Posters In This Topic

Posted Images

Posted

If you can't get the lisp to work, the suggestion by steven-g in post #12 is excellent

PointAlign.JPG

Posted
If you can't get the lisp to work, the suggestion by steven-g in post #12 is excellent

Could you please tell me process to work with the lisp..

Posted

I am afraid that I can't tell you how the lisp works, because I did not use it. I used the method of changing the UCS.

Posted
Here is the sample.......

 

*@*#|^@#* (censored)

 

"Points with z value labelled"

I thought points with fields.

 

:danger:

Posted
*@*#|^@#* (censored)

 

"Points with z value labelled"

I thought points with fields.

 

:danger:

 

:lol: That's the reason why i hold off writing a code for this request.

 

Nice idea BTW _GP

Posted (edited)

Thank you, pBe :)

 

 

@souvik

Try this code for points and mtexts.

 

(defun c:TesT (/ cmd p&t L n L1 L2 p_t ep_t :p1 :p2 :p1z )
   (vl-load-com)
   (setq cmd (getvar 'cmdecho))
   (setvar 'cmdecho 0)
   (command "_.undo" "_begin")
   (if
       (and
           (princ "\nSelect points and mtexts to align")
           (setq p&t (ssget '((0 . "POINT,MTEXT"))))
           (setq L (car (entsel "\nSelect the reference line")))
           (= "LINE" (cdr (assoc 0 (entget L))))
           (or oL (setq oL 0.00))
           (setq oL
                    (cond
                        ( (getdist (strcat "\nOffset from the line <" (rtos oL 2 2) ">:  ")) )
                        ( oL )
                    )
           )
       )
       (progn
           (setq L1 (cdr (assoc 10 (entget L))))
           (setq L2 (cdr (assoc 11 (entget L))))
           (setq L1 (list (car L1) (cadr L1)))
           (setq L2 (list (car L2) (cadr L2)))            
           (repeat (setq n (sslength p&t))
               (setq p_t (ssname p&t (setq n (1- n))))
               (setq :p1 (cdr (assoc 10 (setq ep_t (entget p_t)))))
               (setq :p1z (last :p1) :p1 (list (car :p1) (cadr :p1)))
               (setq :p2 (LM:ProjectPointToLine :p1 L1 L2))
               (if (not (equal oL 0.0 1e-6)) (setq :p2 (polar :p2 (angle :p2 :p1) oL)))
               (if (= "POINT" (cdr (assoc 0 ep_t)))
                   (progn
                       (setq :p2 (list (car :p2) (cadr :p2) :p1z))
                       (vla-put-Coordinates (vlax-ename->vla-object p_t) (vlax-3d-point :p2))
                   )
                   (progn
                       (setq :p2 (list (car :p2) (cadr :p2) :p1z))
                       (setq :p2 (polar :p2 (angle :p2 :p1) (* 1.7 (cdr (assoc 40 ep_t)))))
                       (vla-put-InsertionPoint (vlax-ename->vla-object p_t) (vlax-3d-point :p2))
                   )
               )
           )
       )
   )
   (setvar 'cmdecho cmd)
   (command "_.undo" "_end")
   (princ)
)
;; Project Point onto Line  -  Lee Mac
;; Projects pt onto the line defined by p1,p2
(defun LM:ProjectPointToLine ( pt p1 p2 / nm )
   (setq nm (mapcar '- p2 p1)
         p1 (trans p1 0 nm)
         pt (trans pt 0 nm)
   )
   (trans (list (car p1) (cadr p1) (caddr pt)) nm 0)
)

Edited by GP_

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