Author Topic: lisp help  (Read 5823 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
lisp help
« on: November 05, 2003, 09:00:07 AM »
hey guys i have this lisp which allows me to select any line and it becomes a centerline. the problem is i would like to change the ltscale as well to .25. could someone explain to me how i would do that. thanks

dan

(DEFUN C:LTCL (/ A)
  (PROMPT "\nCHANGE SELECTED LINE TYPES TO CENTER")
  (SETQ A(SSGET))
  (COMMAND "CHANGE" A "" "P" "LT" "CENTER" "")
  (PRINC)
  )

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
lisp help
« Reply #1 on: November 05, 2003, 09:12:06 AM »
Maybe this:
Code: [Select]

(DEFUN C:LTCL (/ A)
(PROMPT "\nCHANGE SELECTED LINE TYPES TO CENTER")
(SETQ A (SSGET))
(COMMAND "CHANGE" A "" "P" "LT" "CENTER" "")
(COMMAND "CHANGE" A "" "P" "ltScale" 0.25 "") <-- here
(PRINC)
)

not tested :D
TheSwamp.org  (serving the CAD community since 2003)

ELOQUINTET

  • Guest
lisp help
« Reply #2 on: November 05, 2003, 09:15:06 AM »
that did it mark thanks

dan

Dave

  • Guest
lisp help
« Reply #3 on: November 09, 2003, 01:04:26 AM »
Go ahead and shoot me.  I just wanted to show an alternative in case anyone cares.  Not tested, but hopefully it makes sense.  Also, it could use some error handling for the linetype being loaded.

Code: [Select]

(defun C:LTCL ( / a i e o)
  (cond
    ( (setq a (ssget))
      (setq i 0)
      (repeat (sslength a)
        (setq e (ssname a i)
                o (vlax-ename->vla-object e)
        )
        (apply-props o
          (list '("Linetype" "CENTER") '("LinetypeScale" 0.25))
        )
        (vlax-release-object o)
        (setq i (1+ i))
      )
    )
  )
  (princ)
)

(defun apply-props (object proplist)
  (foreach prop proplist
    (if (vlax-property-available-p object (car prop))
      (vlax-put-property object (car prop) (cadr prop))
    )
  )
)


Ok, if it blows, it blows and you can all laugh hysterically.  Just don't blow anything through your nostrils while laughing.[/code]

SMadsen

  • Guest
lisp help
« Reply #4 on: November 09, 2003, 07:05:29 AM »
Heh .. it's hard to find anyone who's able to come up with less descriptive variable names.
Must be Dave!  :lol:

Welcome to the board, Dave.

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
lisp help
« Reply #5 on: November 09, 2003, 11:16:24 AM »
Welcome Dave! I hope your stay is a pleasent one, and the neighbors will be over with a 'welcome cake' as soon as they can.  (Please be patient.)
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
lisp help
« Reply #6 on: November 09, 2003, 06:44:18 PM »
I love the variable names. :lol: "a, e i o" ...U did a good job on those prcedures.

:P
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org