Author Topic: How many ways can you create a LINE  (Read 8363 times)

0 Members and 1 Guest are viewing this topic.

JohnK

  • Administrator
  • Seagull
  • Posts: 10552
Re: How many ways can you create a LINE
« Reply #30 on: October 05, 2005, 12:46:25 PM »
*Thinking how i shall call that line "Maverick"*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Bob Wahr

  • Guest
Re: How many ways can you create a LINE
« Reply #31 on: October 05, 2005, 01:02:48 PM »
Here liney liney liney.

LE

  • Guest
Re: How many ways can you create a LINE
« Reply #32 on: October 06, 2005, 11:26:53 PM »
Here is a semi-serious way to draw lines - parallel to each other by just moving the cursor to front or back to paint the lines.... this is just for fun....

Luis.

Code: [Select]
(vl-load-com)

(setq 45Degrees (* pi 0.25))
(setq 90Degrees (* pi 0.5))
(setq 135Degrees (* pi 0.75))
(setq 225Degrees (* pi 1.25))
(setq 270Degrees (* pi 1.5))
(setq 315Degrees (* pi 1.75))
(setq 360Degrees (* pi 2.0))

(if (not *Acad)
  (setq *Acad (vlax-get-acad-object)))

(defun thisDwg () (vla-get-activeDocument *Acad))

(setq
  dtt_thisdwg
   (cond (dtt_thisdwg)
         ((thisDwg))))

(if (not Model)
  (setq Model
         (vla-get-modelSpace dtt_thisdwg)))

(defun pSpace () (vla-get-paperSpace dtt_thisdwg))

(defun get-activeSpace  ()
  (if (= acModelSpace (vla-get-activeSpace dtt_thisdwg))
    Model
    (if (= (vla-get-mSpace dtt_thisdwg) :vlax-true)
      Model
      (pSpace))))

(defun lc-write2file  (n / file p search)
  (setq search (acadFolder))
  (setq file (open (strcat search "$par$") "a"))
  (write-line n file)
  (close file))

(defun lc-readFile  (/ file n tmp search)
  (setq search (acadFolder))
  (if (findfile (strcat search "$par$"))
    (progn
      (setq file (open (findfile (strcat search "$par$")) "r"))
      (while (setq n (read-line file))
        (if (/= n "")
          (setq tmp (append tmp (list n)))))
      (close file)))
  tmp)

(defun lc-file2nil  (/ search)
  (setq search (acadFolder))
  (if (findfile (strcat search "$par$"))
    (vl-file-delete (findfile (strcat search "$par$")))
    nil))

(defun acadFolder  ()
  (substr (findfile "acad.exe")
          1
          (- (strlen (findfile "acad.exe")) 8)))

(defun point2String  (pt)
  (strcat (rtos (car pt) 2 6)
          (rtos (cadr pt) 2 6)
          (rtos (caddr pt) 2 6)))

(defun rtd (a) (* (/ a pi) 180.0))

(defun lc-angle  (/ p1 ang)
  (setq p1 (getpoint "\n<Select LINE>/From point: "))
  (if p1
    (progn

      (setq
        ang (getangle
              (strcat "\nAlignment angle <"
                      (rtos (rtd Atemp) 2 0)
                      ">: ")
              p1))
      (if (= ang nil)
        (setq ang Atemp)
        (setq Atemp ang))
      (setvar "orthomode" 1)
      (list ang p1))
    nil))

(defun lc-vector  (/ anglin ang p1 sep)
  (setq sna (getvar "snapang"))
  (setq anglin (lc-angle))
  (if anglin
    (progn
      (setq ang (car anglin))
      (setq p1 (cadr anglin))
      (setvar "snapang" ang)
      (setq size (getvar "cursorsize"))
      (setvar "cursorsize" 1)
      (initget 6)
      (setq sep
             (getdist p1
                      (strcat "\nTo point/Distance <"
                              (rtos ll)
                              ">: ")))
      (if (= sep nil)
        (setq sep ll))
      (if (not ll)
        (setq ll 1.0))
      (setq ll sep)
      (if sna
        (setvar "snapang" sna))
      (if size
        (setvar "cursorsize" size))
      (list p1 (polar p1 ang sep)))
    nil))

(defun addLine  (start_point end_point / vla_line)
  (if (and start_point
           end_point
           (not (vl-catch-all-error-p
                  (setq
                    vla_line
                     (vl-catch-all-apply
                       'vla-addLine
                       (list (get-activeSpace)
                             (vlax-3d-point start_point)
                             (vlax-3d-point end_point)))))))
    vla_line))

(defun C:CLINE  (/      p1     p2     p3     p4     sep    lcopyent
                  entlist       m      s      n      c      lst
                  obj    take   code5  mklin)
  (if (not Atemp)
    (setq Atemp 0.0))
  (if (not ll)
    (setq ll 1.0))
  (lc-file2nil)
  (setq lst nil)
  (setq mklin (lc-vector))
  (if (= mklin nil)
    (setq obj (entsel "\nSelect line: "))
    (progn (setq p1 (car mklin)) (setq p2 (cadr mklin))))
  (if (and obj (= (cdr (assoc 0 (entget (car obj)))) "LINE"))
    (progn
      (setq lcopyent (car obj))
      (setq
        entlist (entget lcopyent)
        p1      (cdr (assoc 10 entlist))
        p2      (cdr (assoc 11 entlist)))))
  (setq lst (lc-readFile))
  (if (and p1 p2)
    (progn
      (if (and (not (member (point2String p1) lst))
               (not (member (point2String p2) lst)))
        (addLine p1 p2))
      (if (not (member (point2String p1) lst))
        (lc-write2file (point2String p1)))
      (if (not (member (point2String p2) lst))
        (lc-write2file (point2String p2)))
      (setq lst (lc-readFile))))
  (if p1
    (progn
      (setvar "orthomode" 0)
      (initget 6)
      (setq sep
             (getdist
               (strcat
                 "\nSelect two point/<Distance between them = "
                 (rtos ll)
                 ">: ")))
      (if (= sep nil)
        (setq sep ll))
      (if (not ll)
        (setq ll 1.0))
      (setq ll sep)))
  (if (and p1 p2 sep)
    (progn
      (prompt
        "\n<ENTER to exit>/Move cursor to copy")
      (while (not (equal (setq take (grread 't)) '(2 13)))
        (setq code5 (car take))
        (setq p3 (cadr take))
        (if (and p3 (= 5 code5))
          (progn
            (setq
              p4
               (inters p1
                       p2
                       p3
                       (polar p3
                              (+ (angle p1 p2) 90Degrees)
                              1.0)
                       nil))
            (setq
              p1 (polar p1 (angle p4 p3) sep)
              p2 (polar p2 (angle p4 p3) sep))
            (setq lst (lc-readFile))
            (if (and p1 p2)
              (progn
                (if
                  (and
                    (not (member (point2String p1)
                                 lst))
                    (not (member (point2String p2)
                                 lst)))
                   (addLine p1 p2))
                (if
                  (not (member (point2String p1) lst))
                   (lc-write2file (point2String p1)))
                (if
                  (not (member (point2String p2) lst))
                   (lc-write2file (point2String p2))))))
          (progn
            (prompt
              "\r<ENTER to exit>/Move cursor to copy")
            (alert
              "\nWork on current window, other command are disabled\nUse mouse scroll button to zoom in out or pan."))))))
  (setvar "snapang" 0.0)
  (princ))

(princ "\nCLINE by www.geometricad.com ")
(princ)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: How many ways can you create a LINE
« Reply #33 on: October 10, 2005, 11:02:40 PM »
like others...
you can make (command "_.line")
or (vl-cmdf "_.line)
and so on...

But you can also use PLINE with width "0" or command "Trace"..do you forget it ?
you can use "_.SPLINE" "_.XLINE" "_.RAY" depending what you need..

You can make a block containing a simple line at length "0" and insert it, stretch it and...

you can use "(entmake)" <- (I prefer this when it's possible)

why ? because lot of version with lot of language..English / French and blah blah blah..
so the command is not the same. but if you want to use the "LINE" command...
don't forget to put the "_." before !

otherwise...... :pissed:
Keep smile...