Code Red > AutoLISP (Vanilla / Visual)

need lisps

(1/11) > >>

ELOQUINTET:
hey guys i'm trying to find a few simple lisps i've seen posted before but can't seem to locate. here's what i want them to do:

1 offset and erase original line

2 draw line between midpoint of two paralell lines

3 mirror objects :basepoint: midpoint between two paralell lines

4 set all colors to bylayer

thanks

dan

Mark:
No.4

--- Code: ---(defun cotbyl (obj)
        (cond ((= (type obj) 'VLA-OBJECT)
               (vlax-put-property obj 'Color acByLayer)
               (vlax-release-object obj)
               )
              )
        )

--- End code ---

Example:

--- Code: ---
(setq obj (vlax-ename->vla-object (car (entsel))))
(cotbyl obj)

--- End code ---

works with ver. 2000 - 2002
2004 is different.

ELOQUINTET:
hmmm thanks mark but i'm having some sort of problem. i copied and pasted the code into vlide. when i hit save it said something about. cannot create _.ls file do you want to spool. remember recently i turned off the setting to create a backup. well i said no. when i type "cotbyl" it ays unknown command. so what's happening now? thanks

dan

Mark:
try this one

--- Code: ---
;;; change selected objects color to 'ByLayer'
;;; ACAD versions 2000-2002
(defun c:c2bl (/ ss parse-ss cotbyl)

  (defun parse-ss (ss / cntr ent obj-lst)
    (setq cntr 0)
    (while
      (setq ent (ssname ss cntr))
       (setq obj-lst
                     (cons (vlax-ename->vla-object ent) obj-lst)
             cntr    (1+ cntr)
             )
       ) ; while
    (if obj-lst (mapcar 'cotbyl obj-lst))
    ) ; defun

  (defun cotbyl (obj)
    (cond ((= (type obj) 'VLA-OBJECT)
           (vlax-put-property obj 'Color acByLayer)
           (vlax-release-object obj)
           )
          )
    )

  (if (setq ss (ssget))
    (parse-ss ss)
    )
  (princ)
  ); defun

--- End code ---

ELOQUINTET:
thanks mark that one works great. i nearly paniced whew.

dan

Navigation

[0] Message Index

[#] Next page

Go to full version