Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Little modyfication of Heigh Ordinate lisp

3 REPLIES 3
Reply
Message 1 of 4
inostro
157 Views, 3 Replies

Little modyfication of Heigh Ordinate lisp

Good morning

I m a reeeal LISP begginer. And I want to ask for a little help. I think it is very simple for such lisp masters like you;_)
Below is a Height ordinate lisp. My problem: if there is for exapmle 19.40 meters above 0.00 this lisp shows 19.4.....but i need 19.40. As i sad it isnt big problem but i will be very gratefull for help. Thank you very much:)

Here is the lisp: "Kota" is a name of block with graphic and text.

; ========================= Update KOTA - Advance*
; edycja atrybutu w bloku KOTA
(defun c:uk ()
(prompt "\nCommand: Kota - Advance*")
(princ "\n ")
(if (null kotap) (progn
(setq kotap (getpoint "\nWskaz Punkt:"))
)
(progn
(princ "\nWskaz Punkt <")
(princ kotap)
(setq kotap1 (getpoint ">: "))
(if kotap1 (setq kotap kotap1))
))
(princ "\nCommand: Kota - Advance*")
(princ "\n\nPunkt bazowy: ")
(princ (cadr kotap))
(setq ob (ssget '((2 . "KOTA"))))
(setq nr 0)
(repeat (sslength ob)
(setq ss (entupd (ssname ob nr)))
(setq p1 (cdr (assoc 10 (entget ss))))
(setq pow (- (cadr p1) (cadr kotap)))
(setq pow (/ pow 100))
(setq sss ss)
(setq ss (entnext ss))
(setq text "%%p0.000")
(if (> pow 0) (setq text (strcat "+" (rtos pow 2 3))))
(if (< pow 0) (setq text (rtos pow 2 3)))
(setq ss (subst (cons 1 text) (assoc 1 (entget ss)) (entget ss)))
(entmod ss)
(entupd sss)
(setq nr (+ nr 1))
)
)

Thank you for help.
P.S. Sorry for my english...
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: inostro

if the problem is in this line
>(princ (cadr kotap))
(prompt (rtos (cadr kotap) 2 2))

inostro wrote:
> Good morning
>
> I m a reeeal LISP begginer. And I want to ask for a little help. I think it is very simple for such lisp masters like you;_)
> Below is a Height ordinate lisp. My problem: if there is for exapmle 19.40 meters above 0.00 this lisp shows 19.4.....but i need 19.40. As i sad it isnt big problem but i will be very gratefull for help. Thank you very much:)
>
> Here is the lisp: "Kota" is a name of block with graphic and text.
>
> ; ========================= Update KOTA - Advance*
> ; edycja atrybutu w bloku KOTA
> (defun c:uk ()
> (prompt "\nCommand: Kota - Advance*")
> (princ "\n ")
> (if (null kotap) (progn
> (setq kotap (getpoint "\nWskaz Punkt:"))
> )
> (progn
> (princ "\nWskaz Punkt <")
> (princ kotap)
> (setq kotap1 (getpoint ">: "))
> (if kotap1 (setq kotap kotap1))
> ))
> (princ "\nCommand: Kota - Advance*")
> (princ "\n\nPunkt bazowy: ")
> (princ (cadr kotap))
> (setq ob (ssget '((2 . "KOTA"))))
> (setq nr 0)
> (repeat (sslength ob)
> (setq ss (entupd (ssname ob nr)))
> (setq p1 (cdr (assoc 10 (entget ss))))
> (setq pow (- (cadr p1) (cadr kotap)))
> (setq pow (/ pow 100))
> (setq sss ss)
> (setq ss (entnext ss))
> (setq text "%%p0.000")
> (if (> pow 0) (setq text (strcat "+" (rtos pow 2 3))))
> (if (< pow 0) (setq text (rtos pow 2 3)))
> (setq ss (subst (cons 1 text) (assoc 1 (entget ss)) (entget ss)))
> (entmod ss)
> (entupd sss)
> (setq nr (+ nr 1))
> )
> )
>
> Thank you for help.
> P.S. Sorry for my english...
Message 3 of 4
Anonymous
in reply to: inostro

and sorry for my polnisch? 😉

gert wrote:

> if the problem is in this line
> >(princ (cadr kotap))
> (prompt (rtos (cadr kotap) 2 2))
>
> inostro wrote:
>
>>Good morning
>>
>>I m a reeeal LISP begginer. And I want to ask for a little help. I think it is very simple for such lisp masters like you;_)
>>Below is a Height ordinate lisp. My problem: if there is for exapmle 19.40 meters above 0.00 this lisp shows 19.4.....but i need 19.40. As i sad it isnt big problem but i will be very gratefull for help. Thank you very much:)
>>
>>Here is the lisp: "Kota" is a name of block with graphic and text.
>>
>>; ========================= Update KOTA - Advance*
>>; edycja atrybutu w bloku KOTA
>>(defun c:uk ()
>> (prompt "\nCommand: Kota - Advance*")
>> (princ "\n ")
>> (if (null kotap) (progn
>> (setq kotap (getpoint "\nWskaz Punkt:"))
>> )
>> (progn
>> (princ "\nWskaz Punkt <")
>> (princ kotap)
>> (setq kotap1 (getpoint ">: "))
>> (if kotap1 (setq kotap kotap1))
>> ))
>> (princ "\nCommand: Kota - Advance*")
>> (princ "\n\nPunkt bazowy: ")
>> (princ (cadr kotap))
>> (setq ob (ssget '((2 . "KOTA"))))
>> (setq nr 0)
>> (repeat (sslength ob)
>> (setq ss (entupd (ssname ob nr)))
>> (setq p1 (cdr (assoc 10 (entget ss))))
>> (setq pow (- (cadr p1) (cadr kotap)))
>> (setq pow (/ pow 100))
>> (setq sss ss)
>> (setq ss (entnext ss))
>> (setq text "%%p0.000")
>> (if (> pow 0) (setq text (strcat "+" (rtos pow 2 3))))
>> (if (< pow 0) (setq text (rtos pow 2 3)))
>> (setq ss (subst (cons 1 text) (assoc 1 (entget ss)) (entget ss)))
>> (entmod ss)
>> (entupd sss)
>> (setq nr (+ nr 1))
>> )
>>)
>>
>>Thank you for help.
>>P.S. Sorry for my english...
>
>
Message 4 of 4
inostro
in reply to: inostro

Big thanks for your respond!!! :_)
i pasted it into lisp

...(princ "\n\nPunkt bazowy: ")
(princ (cadr kotap))

(prompt (rtos (cadr kotap) 2 2))

(setq ob (ssget '((2 . "KOTA"))))
(setq nr 0)...

and it doesn't work...;(
could u tell me where is the mistake...

thank you

P.S. Danke 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost