Jump to content

Recommended Posts

Posted

Hello, Guys!

I need a litte help in a very easy question about Lisp

I need a Lisp for insert a especific text at a especific point in autocad...

 

Example: I want to write the number 5 at the point:

x = 3

y = 2

 

It's easy, but i don't now how to input the coordinates of the text

Could Someone help me, please??

Posted

Easy

 

; based on some form of values being obtained.
(setq x 3)
(setq y 2)
(setq ans "5")
(command "Text" (list x y) 0.25 0 ans)

Posted

Bigal, your program will work if the default text height is 0.0 but will place the text "0" if the text height is > 0.0. The text command has one less prompt if the default text height is not 0.0. Is there a way to check for the default text height.

 

~Lee

Posted

Lrm you are correct there are two methods to Text one with a preset height the other with height=0.0 There is a couple of ways around this. Its always difficult when posting example code to do with text to know which way to post. As a generic approach at work we set the text style to a preset style in our dwt then we know if height is 0.0 or not.

 

; example of checking current text style has a preset height.
    (setq ts (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE")))))
    (if (zerop ts)
          (command "TEXT" "498,18" "3.5" "0" ans)
          (command "TEXT" "498,18" "0" ans)
    )      

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...