วันอังคารที่ 3 พฤษภาคม พ.ศ. 2565

dimensions distance perpendicular on parallel line

 

;|

       dimensions distance perpendicular on parallel line.

       - Enter Length of Distance on main line.

       - Select object. (main all line and arc)

       - Select object. (Parallel Line Done arc)

|;

(defun LenghtOfObject (obj / len)

       (if (vl-catch-all-error-p (setq len (vl-catch-all-apply 'vlax-curve-getDistAtParam

              (list obj (vl-catch-all-apply 'vlax-curve-getEndParam (list obj)))))) nil len

       )

)

(defun c:dimpll (/ lst)                   

(vl-load-com)

(setq old_cmdecho  (getvar "cmdecho"))

(setq old_osnap (getvar "osmode"))

 

(setvar "cmdecho" 0)

(setvar "snapmode" 0)

;;----------Line STA Length--------

       (or dis (setq dis 1.0))

        (setq lttemp

            (getDist (strcat "\nLength of Distance : <"

                             (rtos dis 2 2)

                                     ">: "

                     ) ;_ strcat

            ) ;_ getdist

        ) ;_ setq

    (and lttemp (setq dis lttemp))

      

       (setq path (entsel "Select Main Line: "))

       (setq x_object (vlax-Ename->Vla-Object (car path)))

       (setq lpath (LenghtOfObject x_object);start point

                ;pt2 (vlax-curve-getendpoint x_object);end point

                sta_dis dis

                lst (list)

                lst_ppt (list)

       )

       (repeat (fix(/ lpath dis))

              (setq p1 (vlax-curve-getpointatdist x_object (abs sta_dis)));;Measure Multiple Distances

              (setq sta_dis (+ sta_dis dis)

                       lst (append lst (list p1))

              )

       )     

       ;(print lst)

       (setq pll (car (entsel "\nSelect Parallel Line : ")))

       (if(= (cdr (assoc 0 (setq e (entget pll)))) "ARC")

        (progn

                     (alert "This ARC Invalid object. Please select Parallel Line object.")

                     (exit)

              )

    )

       (setq ent1 (car path)

                ent2 pll

                ent3 (car path)

       )

       (foreach x lst

              (lb3 ent1 ent2 ent3 x)

       )

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)       

(princ)

)

(prompt "\nCreate and Design by Songkhran Jongkul April 2022")

(princ "\nEnter DIMPLL to Start")

 

(defun LB3 (ent1 ent2 ent3 pt1 / obj1 obj2 pt2); = Lines Between 3 objects

       (command "_.pline"

        "_none" pt1

        "_none"

              (polar

                     pt1

                     (+ (angle '(0 0 0) (vlax-curve-getFirstDeriv ent1 (vlax-curve-getParamAtPoint ent1 pt1))) (/ pi 2))

                     1

              ); polar

        ""

    ); command

    (setq obj1 (vlax-ename->vla-object ent2)

          obj2 (vlax-ename->vla-object (entlast))

          pt2  (vlax-invoke obj1 'IntersectWith obj2 acExtendBoth)

    ); setq

    (entdel (entlast))

    (command "_.pline" "_none" pt1 "_none" pt2 "_none" (vlax-curve-getClosestPointTo ent3 pt2) "")

       (command "_.DIMALIGNED"

             "_none" (trans pt1 0 1)

             "_none" (trans pt2 0 1)

             "_none" (trans pt1 0 1)

       )

  (princ)

)