วันจันทร์ที่ 11 เมษายน พ.ศ. 2565

Dim. parallel line.

 

;|

      dimensions distance perpendicular on parallel line.

      - Enter Length of Distance on main line.

      - Select object. (main line)

      - Select object. (Parallel Line)

|;

 

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

      (command

            "_.line"

        "_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 "_.DIMALIGNED"

             "_none" (trans pt1 0 1)

             "_none" (trans pt2 0 1)

             "_none" (trans pt1 0 1)

      )

  (princ)

)

(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 pt1 (vlax-curve-getstartpoint x_object);start point

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

              sta_dis dis

              lst (list)

              lst_ppt (list)

      )

      (repeat (fix(/ (distance pt1 pt2) 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 pline (car (entsel "\nSelect Parallel Line: ")))

      (setq ent1 (car path)

              ent2 pline

              ent3 (car path)

      )

      (foreach x lst

            (lb3 ent1 ent2 ent3 x)

      )

(setvar "cmdecho" old_cmdecho)

(setvar "osmode" old_osnap)  

(princ)

)

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

(prompt "\n Enter DIMPLL to Start")