Author Topic: lisp ran within a lisp  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

Oak3s

  • Guest
lisp ran within a lisp
« on: November 12, 2004, 04:51:15 PM »
Hey everyone. i have about 2000 or so some odd (maybe even) details to go through. i would like to use a script for this but the varuables are not constant. so anyway. what i am trying to do is move the insertion point to 0,0,0 and the base point there aswell. i have that part working. i also want to move some things to a particular point first. this is already done with a seperate lisp. what i want to do is add one to the other and in the list have a part that says something like (command "theotherone")
i tryied it but it doesnt run all the way through both. they work separetly fine. i could go about it a different way but i just dont want to if i can get around it. so could someone tell me a way similar to this. would be appreciated. thanks.
oh, and last time i checked i was a masqito (alaskas state bird)
Jeremy

Oak3s

  • Guest
lisp ran within a lisp
« Reply #1 on: November 12, 2004, 07:21:19 PM »
maybe i didnt explain it very well. or maybe i did and the people who have looked at this were looking for the answer to.
i will try to explain it in a different way.
ex) one function draws a line from midpoint 1 to midpoint 2 and puts it on layer y.
another function puts text in a location centerd on a line.

so in the same lsp file i have both functions seperate. after the first one draws the line i would want the second one to start without typing in the call. but i want to 'call' it in the code like you would a command.
i hope this helps. maybe it wont. but thats alright. if i post enough nonsense posts mabye i wont be on the level of a mosquito (which i spelled wrong last post) or a leech. ;) eveyone enjoy the weekend if it applies.
Jeremy

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
lisp ran within a lisp
« Reply #2 on: November 12, 2004, 08:04:52 PM »
Code: [Select]

;;; example 1
(defun c:make-txt (/ p1 txt_string)

  ; create a text entity

  (if (setq p1 (getpoint "\nSelect Text Insertion Point: "))
    (if (setq txt_string (getstring T "\nEnter Text: "))
      (entmake
        (list '(0 . "TEXT")
              (cons 8 "LAYER-X")
              (cons 10 p1)
              (cons 40 (getvar "TEXTSIZE"))
              (cons 1 txt_string)
              ;'(7 . "Standard") default style
              '(11 0.0 0.0 0.0)
              )
        )
      )
    )
  (princ)
  )

(defun c:ld1 (/ p1 p2 line)

  ; create a line based on two picked points

  (if (setq p1 (getpoint "\nSelect Point 1: "))
    (if (setq p2 (getpoint p1 "\nSelect Point 2: "))
      (if
        (entmake
          (list '(0 . "LINE")
                (cons 8 "LAYER-Y")
                (cons 10 p1)
                (cons 11 p2)
                )
          )
        ; assuming all the above goes well call the other function
        (c:make-txt)
        )
      )
    )
  (princ)
  )



;;; example 2
(defun c:ld2 (/ make-txt p1 p2 line)

  (defun make-txt (/ p1 txt_string)

    ; create a text entity

    (if (setq p1 (getpoint "\nSelect Text Insertion Point: "))
      (if (setq txt_string (getstring T "\nEnter Text: "))
        (entmake
          (list '(0 . "TEXT")
                (cons 8 "LAYER-X")
                (cons 10 p1)
                (cons 40 (getvar "TEXTSIZE"))
                (cons 1 txt_string)
                ;'(7 . "Standard") default style
                '(11 0.0 0.0 0.0)
                )
          )
        )
      )
    (princ)
    )

  ; create a line based on two picked points

  (if (setq p1 (getpoint "\nSelect Point 1: "))
    (if (setq p2 (getpoint p1 "\nSelect Point 2: "))
      (if
        (entmake
          (list '(0 . "LINE")
                (cons 8 "LAYER-Y")
                (cons 10 p1)
                (cons 11 p2)
                )
          )
        ; assuming all the above goes well call the other function
        (make-txt)
        )
      )
    )
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

Oak3s

  • Guest
lisp ran within a lisp
« Reply #3 on: November 12, 2004, 08:27:52 PM »
such a simple thing
(c:make-txt)
thats what i was looking for.  :oops:  man i hate when its something that simple but i cant explain what im looking for. thanks for the help Mark
Jeremy