Author Topic: Mtext Coding  (Read 2489 times)

0 Members and 1 Guest are viewing this topic.

AWW

  • Guest
Mtext Coding
« on: January 06, 2010, 12:24:25 PM »
What I have: User specified points

(setq p4  (getpoint "\nSelect top left corner: ")
(setq p5  (getcorner p1 "\nSelect bottom rigth corner: ")

What I'm shooting for: Points specified by mathematical equation.

(setq  p4 (polar (+ p3 4)
         p5 (polar (+ p4 20))))

I thought polar would do the trick. I must be missing something. Could it be the structure that I wrote it? Or a different function?
I have attached the full lisp. Note: I got some of this coding from the forums. Credit goes to those that posted it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Mtext Coding
« Reply #1 on: January 06, 2010, 12:39:12 PM »
Polar need three arguments
Code: [Select]
(startPoint Angle Distance)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AWW

  • Guest
Re: Mtext Coding
« Reply #2 on: January 06, 2010, 02:00:12 PM »
Thanks for the heads up on the polar.  Even after correcting that, I get this:

Select third point: ; error: bad function: (2019.86 2106.43 0.0)

From this, I know that the first part (leader) of my code is good. The second
part (mtext) seems to be the problem. So that narrowsit down to possibly
these two lines i believe:

(setq pt4  (polar ( pt3 0 4)
(setq pt5 (polar ( pt4 0 20))))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Mtext Coding
« Reply #3 on: January 06, 2010, 02:05:46 PM »
(setq pt4 (polar pt3 0. 4.))
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

AWW

  • Guest
Re: Mtext Coding
« Reply #4 on: January 06, 2010, 02:26:54 PM »
(setq pt4 (polar pt3 0. 4.))
(setq pt5 (polar pt4 0. 20))

I get:
LISP command is not available.

For some reason, it doesn't seem to be recognizing the
commands I wrote.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Mtext Coding
« Reply #5 on: January 06, 2010, 02:40:41 PM »
You have an extra right parenthesis after the ' setq pt5 '.  Take that out, and the code runs.  Next you should think about localizing your variables.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Mtext Coding
« Reply #6 on: January 06, 2010, 02:55:52 PM »
AWW,

If you aren't already, use a code editor program, like the Visual LISP Editor in ACAD, or maybe Notepad++, or Vim.

With the Visual LISP Editor (VLIDE), you can look up functions in the help and see how to use them.

Lee

AWW

  • Guest
Re: Mtext Coding
« Reply #7 on: January 07, 2010, 12:57:09 PM »
Thanks for the tip. I shall check out vlide!  :kewl:

DEVITG

  • Bull Frog
  • Posts: 481
a good place to start
« Reply #8 on: January 08, 2010, 03:16:14 AM »
My first ABC LISP

      http://ronleigh.info/autolisp/index.htm




 
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Mtext Coding
« Reply #9 on: January 08, 2010, 08:04:18 AM »