Author Topic: Draw Cross  (Read 3307 times)

0 Members and 1 Guest are viewing this topic.

antistar

  • Guest
Draw Cross
« on: February 22, 2013, 12:17:58 PM »
Hi masters,
I need a routine to draw a cross inside all selected polylines.
Serving to rectangles, trapezius, circles and ellipses.

Any help will be appreciated.

Thanks in advance.
« Last Edit: February 25, 2013, 01:28:45 PM by antistar »

ribarm

  • Gator
  • Posts: 3310
  • Marko Ribar, architect
Re: Draw Cross
« Reply #1 on: February 22, 2013, 02:44:40 PM »
Try this :

Code - Auto/Visual Lisp: [Select]
  1. (defun unit ( v )
  2.   (mapcar '(lambda ( x ) (/ x (distance '(0.0 0.0 0.0) v))) v)
  3. )
  4.  
  5. (defun mxv ( m v )
  6.   (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
  7. )
  8.  
  9. (defun v^v ( u v )
  10.   (list
  11.     (- (* (cadr u) (caddr v)) (* (cadr v) (caddr u)))
  12.     (- (* (car  v) (caddr u)) (* (car  u) (caddr v)))
  13.     (- (* (car  u) (cadr  v)) (* (car  v) (cadr  u)))
  14.   )
  15. )
  16.  
  17. (defun transptucs ( pt p1 p2 p3 / ux uy uz )
  18.   (setq uz (unit (v^v (mapcar '- p2 p1) (mapcar '- p3 p1))))
  19.   (setq ux (unit (mapcar '- p2 p1)))
  20.   (setq uy (unit (mapcar '- p3 p1)))
  21.  
  22.   (mxv (list ux uy uz) (mapcar '- pt p1))
  23. )
  24.  
  25. (defun transptwcs ( pt pt1 pt2 pt3 / pt1n pt2n pt3n )
  26.   (setq pt1n (transptucs '(0.0 0.0 0.0) pt1 pt2 pt3))
  27.   (setq pt2n (transptucs '(1.0 0.0 0.0) pt1 pt2 pt3))
  28.   (setq pt3n (transptucs '(0.0 1.0 0.0) pt1 pt2 pt3))
  29.   (transptucs pt pt1n pt2n pt3n)
  30. )
  31.  
  32. (defun GroupByNum ( l n / f )
  33.   (defun f ( a b )
  34.     (if (and a (< 0 b))
  35.       (cons (car a) (f (setq l (cdr a)) (1- b)))
  36.     )
  37.   )
  38.   (if l (cons (f l n) (GroupByNum l n)))
  39. )
  40.  
  41. (defun getwcs3dvertpl ( e / coords ptlst plel ux uy uz )
  42.   (setq coords (vlax-safearray->list (vlax-variant-value (vla-get-coordinates (if (eq (type e) 'ename) (setq e (vlax-ename->vla-object e)) e)))))
  43.   (cond
  44.     ((eq (vla-get-objectname e) "AcDbPolyline")
  45.      (setq ptlst (GroupByNum coords 2)))
  46.     ((eq (vla-get-objectname e) "AcDb2dPolyline")
  47.      (setq ptlst (GroupByNum coords 3)))
  48.     ((eq (vla-get-objectname e) "AcDb3dPolyline")
  49.      (setq ptlst (GroupByNum coords 3)))
  50.   )
  51.   (if (vlax-property-available-p e 'Elevation) (setq plel (vla-get-elevation e)))
  52.   (if plel (setq ptlst (mapcar '(lambda ( x ) (list (car x) (cadr x) plel)) ptlst)))
  53.   (if (vlax-property-available-p e 'Normal) (setq uz (vlax-safearray->list (vlax-variant-value (vla-get-normal e)))))
  54.   (if uz
  55.     (progn
  56.       (if (equal uz '(0.0 0.0 1.0) 1e-8) (setq ux '(1.0 0.0 0.0) uy '(0.0 1.0 0.0)))
  57.       (if (equal uz '(0.0 0.0 -1.0) 1e-8) (setq ux '(-1.0 0.0 0.0) uy '(0.0 1.0 0.0)))
  58.       (if (not (or (equal uz '(0.0 0.0 1.0) 1e-8) (equal uz '(0.0 0.0 -1.0) 1e-8))) (setq ux (unit (v^v '(0.0 0.0 1.0) uz))))
  59.       (if (not uy) (setq uy (unit (v^v uz ux))))
  60.       (setq ptlst (mapcar '(lambda ( p ) (transptwcs p '(0.0 0.0 0.0) ux uy)) ptlst))
  61.     )
  62.   )
  63.   ptlst
  64. )
  65.  
  66. (defun c:crosses ( / cmde osm ss2dhpoly ss n ent ptlst stpar enpar par p1 p2 p3 p4 )
  67.   (setq cmde (getvar 'cmdecho))
  68.   (setq osm (getvar 'osmode))
  69.   (setvar 'cmdecho 0)
  70.   (setvar 'osmode 0)
  71.   (defun *error* ( msg )
  72.     (if cmde (setvar 'cmdecho cmde))
  73.     (if osm (setvar 'osmode osm))
  74.     (if msg (princ msg))
  75.   )
  76.   (setq ss2dhpoly (ssget "_X" (list '(0 . "POLYLINE") '(70 . 1))))
  77.   (if ss2dhpoly (command "_.convertpoly" "_L" ss2dhpoly ""))
  78.   (prompt "\nSelect objects to draw crosses inside")
  79.   (while (not (setq ss (ssget (list '(-4 . "<or")
  80.                                     '(-4 . "<and") '(0 . "LWPOLYLINE") '(70 . 1) '(90 . 4) '(-4 . "and>")
  81.                                     '(-4 . "<and") '(0 . "ELLIPSE") '(41 . 0.0) (cons 42 (* 2.0 pi)) '(-4 . "and>")
  82.                                     '(0 . "CIRCLE")
  83.                                     '(-4 . "or>")
  84.                               )
  85.                         )
  86.               )
  87.           )
  88.   )
  89.   (repeat (setq n (sslength ss))
  90.     (setq ent (ssname ss (setq n (1- n))))
  91.     (cond ( (eq (cdr (assoc 0 (entget ent))) "LWPOLYLINE")
  92.             (setq ptlst (getwcs3dvertpl ent))
  93.             (entmake (list '(0 . "LINE") (cons 10 (nth 0 ptlst)) (cons 11 (nth 2 ptlst))))
  94.             (entmake (list '(0 . "LINE") (cons 10 (nth 1 ptlst)) (cons 11 (nth 3 ptlst))))
  95.           )
  96.           ( (or (eq (cdr (assoc 0 (entget ent))) "ELLIPSE") (eq (cdr (assoc 0 (entget ent))) "CIRCLE"))
  97.             (setq stpar (vlax-curve-getstartparam ent)
  98.                   enpar (vlax-curve-getendparam ent)
  99.                   par (- enpar stpar)
  100.             )
  101.             (mapcar 'set '(p1 p2 p3 p4)
  102.                     (mapcar '(lambda ( p ) (vlax-curve-getpointatparam ent p))
  103.                       (mapcar '(lambda ( k ) (+ (* k (/ par 4.0)) (- stpar (/ par 8.0))))
  104.                         '(1.0 2.0 3.0 4.0)
  105.                       )
  106.                     )
  107.             )
  108.             (entmake (list '(0 . "LINE") (cons 10 p1) (cons 11 p3)))
  109.             (entmake (list '(0 . "LINE") (cons 10 p2) (cons 11 p4)))
  110.           )
  111.     )
  112.   )    
  113.   (if ss2dhpoly (command "_.convertpoly" "_H" ss2dhpoly ""))
  114.   (*error* nil)
  115.   (princ)
  116. )
  117.  
  118. (prompt "\nInvoke with : crosses")
  119.  

M.R.
« Last Edit: September 20, 2013, 04:34:56 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

antistar

  • Guest
Re: Draw Cross
« Reply #2 on: February 22, 2013, 03:43:02 PM »
Hi Marko,
First of all, thanks for your reply.
The routine works well, but only with LWPOLYLINES.
In my drawings there are objects with the following features, which are not selected:

                 POLYLINE  Layer: "0"
                            Space: Model space
                   Color: 7 (white)    Linetype: "BYLAYER"
                   Handle = c11f2
              Open
    starting width    0.0000
      ending width    0.0000
              area 1359.5024
            length  158.7602

                  VERTEX    Layer: "0"
                            Space: Model space
                   Color: 7 (white)    Linetype: "BYLAYER"
                   Handle = c11f3
                at point, X=-18896.8696  Y=-2586.5831  Z=   0.0000
    starting width    0.0000
      ending width    0.0000

                  VERTEX    Layer: "0"
                            Space: Model space
                   Color: 7 (white)    Linetype: "BYLAYER"
                   Handle = c11f4
                at point, X=-18871.8696  Y=-2586.5831  Z=   0.0000
    starting width    0.0000
      ending width    0.0000

                  VERTEX    Layer: "0"
                            Space: Model space
                   Color: 7 (white)    Linetype: "BYLAYER"
                   Handle = c11f5
                at point, X=-18871.8696  Y=-2532.2030  Z=   0.0000
    starting width    0.0000
      ending width    0.0000

                  VERTEX    Layer: "0"
                            Space: Model space

ribarm

  • Gator
  • Posts: 3310
  • Marko Ribar, architect
Re: Draw Cross
« Reply #3 on: February 22, 2013, 04:05:50 PM »
Try again... It works on my comp.

Old heavy 2d polylines are converted to lightweight polylines at start of routine, and at the end they are converted back to their original state... I changed a little to check if that ss2dhpoly exist, and if it does exist only then perform convertpoly command...

ps. If you prefer connecting quadrant points of circles and ellipses, just change in above posted code line 101 to :
Code - Auto/Visual Lisp: [Select]
  1. (mapcar '(lambda ( k ) (+ (* k (/ par 4.0)) (- stpar (/ par 4.0))))
  2.  

Regards, M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Draw Cross
« Reply #4 on: February 22, 2013, 07:06:23 PM »
Here's another, using only Vanilla AutoLISP:

Code: [Select]
;; Cross  -  Lee Mac 2013
(defun c:cross ( / ax bx cn el en in mj mt rd rt ss tp uv vl zv )   
    (if
        (setq ss
            (ssget
                (list
                   '(-4 . "<OR")
                       '(0 . "CIRCLE")
                       '(-4 . "<AND")
                           '(0 . "LWPOLYLINE")
                           '(90 . 4)
                           '(70 . 1)
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "POLYLINE")
                           '(-4 . "&=")
                           '(70 . 1)
                           '(-4 . "<NOT")
                                '(-4 . "&")
                                '(70 . 118)
                           '(-4 . "NOT>")
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "ELLIPSE")
                           '(41 . 0.0)
                            (cons 42 (+ pi pi))
                       '(-4 . "AND>")
                   '(-4 . "OR>")
                )
            )
        )
        (repeat (setq in (sslength ss))
            (setq en (entget (ssname ss (setq in (1- in))))
                  zv (cdr (assoc 210 en))
                  tp (cdr (assoc 0 en))
                  vl nil
            )
            (cond
                (   (wcmatch tp "*POLYLINE")
                    (if (= "LWPOLYLINE" tp)
                        (foreach x en (if (= 10 (car x)) (setq vl (cons (cdr x) vl))))
                        (progn
                            (setq en (entnext (cdr (assoc -1 en)))
                                  el (entget en)
                            )
                            (while (= "VERTEX" (cdr (assoc 00 el)))
                                (setq vl (cons (cdr (assoc 10 el)) vl)
                                      en (entnext en)
                                      el (entget  en)
                                )
                            )
                         )
                     )   
                     (repeat 2 (myline (trans (car vl) zv 0) (trans (cadr (setq vl (cdr vl))) zv 0)))
                )
                (   (= "CIRCLE" tp)
                    (setq cn (cdr (assoc 10 en))
                          rd (/ (cdr (assoc 40 en)) (sqrt 2.0))
                          rd (list rd rd)
                    )
                    (repeat 2
                        (myline (trans (mapcar '+ cn rd) zv 0) (trans (mapcar '- cn rd) zv 0))
                        (setq rd (list (car rd) (- (cadr rd))))
                    )
                )
                (   (setq cn (trans (cdr (assoc 10 en)) 0 zv)
                          mj (trans (cdr (assoc 11 en)) 0 zv)
                          ax (distance '(0.0 0.0) mj)
                          bx (* ax (cdr (assoc 40 en)))
                          rt (apply 'atan (cdr (reverse mj)))
                          mt (list (list (cos rt) (- (sin rt))) (list (sin rt) (cos rt)))
                          uv (/ pi 4.0)
                    )
                    (repeat 2
                        (myline
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos uv)) (* bx (sin uv))))) zv 0)
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos (+ uv pi))) (* bx (sin (+ uv pi)))))) zv 0)
                        )
                        (setq uv (+ uv (/ pi 2.0)))
                    )
                )
            )
        )
    )
    (princ)
)

(defun myline ( a b )
    (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
)

;; Matrix x Vector  -  Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n
 
(defun mxv ( m v )
    (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)
(princ)



The above should also work with objects constructed in any UCS.
« Last Edit: February 25, 2013, 08:19:57 AM by Lee Mac »

antistar

  • Guest
Re: Draw Cross
« Reply #5 on: February 24, 2013, 09:54:11 AM »
Try again... It works on my comp.

Old heavy 2d polylines are converted to lightweight polylines at start of routine, and at the end they are converted back to their original state... I changed a little to check if that ss2dhpoly exist, and if it does exist only then perform convertpoly command...

ps. If you prefer connecting quadrant points of circles and ellipses, just change in above posted code line 101 to :
Code - Auto/Visual Lisp: [Select]
  1. (mapcar '(lambda ( k ) (+ (* k (/ par 4.0)) (- stpar (/ par 4.0))))
  2.  

Regards, M.R.

Hi Marko,
Still does not work with objects polylines that I have in my drawings.
See attached drawing.

antistar

  • Guest
Re: Draw Cross
« Reply #6 on: February 24, 2013, 10:04:38 AM »
Here's another, using only Vanilla AutoLISP:

Code: [Select]
;; Cross  -  Lee Mac 2013
(defun c:cross ( / ax bx cn el en in mj mt rd rt ss tp uv vl zv )   
    (if
        (setq ss
            (ssget
                (list
                   '(-4 . "<OR")
                       '(0 . "CIRCLE")
                       '(-4 . "<AND")
                           '(0 . "LWPOLYLINE")
                           '(90 . 4)
                           '(70 . 1)
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "POLYLINE")
                           '(-4 . "&=")
                           '(70 . 1)
                           '(-4 . "<NOT")
                                '(-4 . "&")
                                '(70 . 118)
                           '(-4 . "NOT>")
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "ELLIPSE")
                           '(41 . 0.0)
                            (cons 42 (+ pi pi))
                       '(-4 . "AND>")
                   '(-4 . "OR>")
                )
            )
        )
        (repeat (setq in (sslength ss))
            (setq en (entget (ssname ss (setq in (1- in))))
                  zv (cdr (assoc 210 en))
                  tp (cdr (assoc 0 en))
                  vl nil
            )
            (cond
                (   (wcmatch tp "*POLYLINE")
                    (if (= "LWPOLYLINE" tp)
                        (foreach x en (if (= 10 (car x)) (setq vl (cons (cdr x) vl))))
                        (progn
                            (setq en (entnext (cdr (assoc -1 en)))
                                  el (entget en)
                            )
                            (while (= "VERTEX" (cdr (assoc 00 el)))
                                (setq vl (cons (cdr (assoc 10 el)) vl)
                                      en (entnext en)
                                      el (entget  en)
                                )
                            )
                         )
                     )   
                     (repeat 2 (myline (trans (car vl) zv 0) (trans (cadr (setq vl (cdr vl))) zv 0)))
                )
                (   (= "CIRCLE" tp)
                    (setq cn (cdr (assoc 10 en))
                          rd (/ (cdr (assoc 40 en)) (sqrt 2.0))
                          rd (list rd rd)
                    )
                    (repeat 2
                        (myline (trans (mapcar '+ cn rd) zv 0) (trans (mapcar '- cn rd) zv 0))
                        (setq rd (list (car rd) (- (cadr rd))))
                    )
                )
                (   (setq cn (trans (cdr (assoc 10 en)) 0 zv)
                          mj (trans (cdr (assoc 11 en)) 0 zv)
                          ax (distance '(0.0 0.0) mj)
                          bx (* ax (cdr (assoc 40 en)))
                          rt (apply 'atan (cdr (reverse mj)))
                          mt (list (list (cos rt) (- (sin rt))) (list (sin rt) (cos rt)))
                          uv (/ pi 4.0)
                    )
                    (repeat 2
                        (myline
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos uv)) (* bx (sin uv))))) zv 0)
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos (+ uv pi))) (* bx (sin (+ uv pi)))))) zv 0)
                        )
                        (setq uv (+ uv (/ pi 2.0)))
                    )
                )
            )
        )
    )
    (princ)
)

(defun myline ( a b )
    (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
)

;; Matrix x Vector  -  Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n
 
(defun mxv ( m v )
    (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)
(princ)

The above should also work with objects constructed in any UCS.

Hi Lee,
Thanks a lot for your reply.
A great work, but unfortunately your routine does not work with my polylines.
See attached drawing.

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Draw Cross
« Reply #7 on: February 24, 2013, 10:44:38 AM »
A great work, but unfortunately your routine does not work with my polylines.

Your polylines are not closed as required by the program.
Select all polylines, open the Properties palette and set the 'Closed' property to 'Yes'.

Alternatively, run this simple program to close your polylines:
Code: [Select]
(defun c:pclose ( / s )
    (if (setq s (ssget "_:L" '((0 . "*POLYLINE"))))
        (command "_.pedit" "_M" s "" "_C" "")
    )
    (princ)
)

antistar

  • Guest
Re: Draw Cross
« Reply #8 on: February 25, 2013, 08:07:49 AM »
Marko and Lee,

Thanks a lot for your help and explanations.

Best regards.  :-)

Sam

  • Bull Frog
  • Posts: 201
Re: Draw Cross
« Reply #9 on: February 25, 2013, 11:52:12 PM »
Here's another, using only Vanilla AutoLISP:

Code: [Select]
;; Cross  -  Lee Mac 2013
(defun c:cross ( / ax bx cn el en in mj mt rd rt ss tp uv vl zv )   
    (if
        (setq ss
            (ssget
                (list
                   '(-4 . "<OR")
                       '(0 . "CIRCLE")
                       '(-4 . "<AND")
                           '(0 . "LWPOLYLINE")
                           '(90 . 4)
                           '(70 . 1)
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "POLYLINE")
                           '(-4 . "&=")
                           '(70 . 1)
                           '(-4 . "<NOT")
                                '(-4 . "&")
                                '(70 . 118)
                           '(-4 . "NOT>")
                       '(-4 . "AND>")
                       '(-4 . "<AND")
                           '(0 . "ELLIPSE")
                           '(41 . 0.0)
                            (cons 42 (+ pi pi))
                       '(-4 . "AND>")
                   '(-4 . "OR>")
                )
            )
        )
        (repeat (setq in (sslength ss))
            (setq en (entget (ssname ss (setq in (1- in))))
                  zv (cdr (assoc 210 en))
                  tp (cdr (assoc 0 en))
                  vl nil
            )
            (cond
                (   (wcmatch tp "*POLYLINE")
                    (if (= "LWPOLYLINE" tp)
                        (foreach x en (if (= 10 (car x)) (setq vl (cons (cdr x) vl))))
                        (progn
                            (setq en (entnext (cdr (assoc -1 en)))
                                  el (entget en)
                            )
                            (while (= "VERTEX" (cdr (assoc 00 el)))
                                (setq vl (cons (cdr (assoc 10 el)) vl)
                                      en (entnext en)
                                      el (entget  en)
                                )
                            )
                         )
                     )   
                     (repeat 2 (myline (trans (car vl) zv 0) (trans (cadr (setq vl (cdr vl))) zv 0)))
                )
                (   (= "CIRCLE" tp)
                    (setq cn (cdr (assoc 10 en))
                          rd (/ (cdr (assoc 40 en)) (sqrt 2.0))
                          rd (list rd rd)
                    )
                    (repeat 2
                        (myline (trans (mapcar '+ cn rd) zv 0) (trans (mapcar '- cn rd) zv 0))
                        (setq rd (list (car rd) (- (cadr rd))))
                    )
                )
                (   (setq cn (trans (cdr (assoc 10 en)) 0 zv)
                          mj (trans (cdr (assoc 11 en)) 0 zv)
                          ax (distance '(0.0 0.0) mj)
                          bx (* ax (cdr (assoc 40 en)))
                          rt (apply 'atan (cdr (reverse mj)))
                          mt (list (list (cos rt) (- (sin rt))) (list (sin rt) (cos rt)))
                          uv (/ pi 4.0)
                    )
                    (repeat 2
                        (myline
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos uv)) (* bx (sin uv))))) zv 0)
                            (trans (mapcar '+ cn (mxv mt (list (* ax (cos (+ uv pi))) (* bx (sin (+ uv pi)))))) zv 0)
                        )
                        (setq uv (+ uv (/ pi 2.0)))
                    )
                )
            )
        )
    )
    (princ)
)

(defun myline ( a b )
    (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
)

;; Matrix x Vector  -  Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n
 
(defun mxv ( m v )
    (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)
(princ)



The above should also work with objects constructed in any UCS.

Dear Sir,

Very Nice Lisp
Thxx..

can u add layer for cross line
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Draw Cross
« Reply #10 on: February 26, 2013, 01:12:48 AM »
Here's another, using only Vanilla AutoLISP:


Dear Sir,

Very Nice Lisp
Thxx..

can u add layer for cross line

for this part of code
Code: [Select]
(defun myline ( a b )
    (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
)

Play with this
Code: [Select]
(defun myline ( a b )
    (entmake (list (cons 0 "LINE") ;***
       (cons 6 "BYLAYER") ; Linetype name (present if not BYLAYER).
; The special name BYBLOCK indicates a floating linetype (optional)
       (cons 8 "0") ; Layer name
       (cons 10 a) ;***
       (cons 11 b) ;***
       (cons 39 0.0) ; Thickness (optional; default = 0)
       (cons 62 256) ; Color number (present if not BYLAYER); zero indicates the BYBLOCK (floating) color
; 256 indicates BYLAYER; a negative value indicates that the layer is turned off (optional)
       (cons 210
     (list 0.0 0.0 1.0) ; Extrusion direction (optional; default = 0, 0, 1)
; DXF: X value; APP: 3D vector
       )
)
)
)

Sam

  • Bull Frog
  • Posts: 201
Re: Draw Cross
« Reply #11 on: February 26, 2013, 02:35:14 AM »

[/quote]

Dear Sir,

Very Nice Lisp
Thxx..

can u add layer for cross line
[/quote]

for this part of code
Code: [Select]
(defun myline ( a b )
    (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
)

Play with this
Code: [Select]
(defun myline ( a b )
    (entmake (list (cons 0 "LINE") ;***
       (cons 6 "BYLAYER") ; Linetype name (present if not BYLAYER).
; The special name BYBLOCK indicates a floating linetype (optional)
       (cons 8 "0") ; Layer name
       (cons 10 a) ;***
       (cons 11 b) ;***
       (cons 39 0.0) ; Thickness (optional; default = 0)
       (cons 62 256) ; Color number (present if not BYLAYER); zero indicates the BYBLOCK (floating) color
; 256 indicates BYLAYER; a negative value indicates that the layer is turned off (optional)
       (cons 210
     (list 0.0 0.0 1.0) ; Extrusion direction (optional; default = 0, 0, 1)
; DXF: X value; APP: 3D vector
       )
)
)
)
[/quote]

thxxx sir
Quote
(cons 8 "0")      ; Layer name
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: Draw Cross
« Reply #12 on: February 26, 2013, 05:42:23 AM »
Thanks Sam  8-)

HasanCAD

  • Swamp Rat
  • Posts: 1422
Re: Draw Cross
« Reply #13 on: February 26, 2013, 06:33:31 AM »
Welcome