Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 9
Anonymous
373 Views, 8 Replies

Arc Length

Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

"Rich Banker" wrote in message news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?


Yes, but I'm not at liberty to distribute it.

While you are waiting, Check out DIMARC.LSP at http://www.turvill.com/t2/free_stuff/index.htm

It's not exactly what you are asking for, but it may do if you cannot find just the right routine.
Message 3 of 9
Anonymous
in reply to: Anonymous

Try this:

(defun c:darc( / osm ar arc rad pt1 pt2) ; Dim. Arc (for "R25'")
(setvar "peditaccept" 1)
(setq osm (getvar "osmode"))
(setvar "osmode" 512) ;near
(while
(setq ar(entsel "\nSelect an arc where you want to place the text: "))
(setq arc (entget (car ar)))
(if(member(cdr(assoc 0 arc))'("CIRCLE" "ARC"))
(progn
(setq rad (cdr(assoc 40 arc)))
(setq pt1 (cadr ar))
(setq pt2 (getpoint "\nPick a direction (NEAR)" ))
(if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
(command "text" "J" "bl" pt1 "" pt2 (strcat "R" (rtos rad 2 2)))
(command "text" "J" "bl" pt1 pt2 (strcat "R" (rtos rad 2 2)))
)
) ;progn
(princ "\nNot a CIRCLE or ARC")
) ;if
) ;while
(setvar "osmode" osm)

You can alter it to read L= . . .

rs

"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich
Message 4 of 9
Anonymous
in reply to: Anonymous

When I try to run it, I get the error message "error: malformed list on
input"

What does that mean, and is it possible to fix?

Thanks for your help, I really appreciate it!

Rich

"tcebob" wrote in message
news:4835343@discussion.autodesk.com...
Try this:

(defun c:darc( / osm ar arc rad pt1 pt2) ; Dim. Arc (for "R25'")
(setvar "peditaccept" 1)
(setq osm (getvar "osmode"))
(setvar "osmode" 512) ;near
(while
(setq ar(entsel "\nSelect an arc where you want to place the text: "))
(setq arc (entget (car ar)))
(if(member(cdr(assoc 0 arc))'("CIRCLE" "ARC"))
(progn
(setq rad (cdr(assoc 40 arc)))
(setq pt1 (cadr ar))
(setq pt2 (getpoint "\nPick a direction (NEAR)" ))
(if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
(command "text" "J" "bl" pt1 "" pt2 (strcat "R" (rtos rad 2 2)))
(command "text" "J" "bl" pt1 pt2 (strcat "R" (rtos rad 2 2)))
)
) ;progn
(princ "\nNot a CIRCLE or ARC")
) ;if
) ;while
(setvar "osmode" osm)

You can alter it to read L= . . .

rs

"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich
Message 5 of 9
Anonymous
in reply to: Anonymous

Thanks for your time and the link, but that's not quite what I'm looking
for.

Rich


"R.K. McSwain" wrote in message
news:4835285@discussion.autodesk.com...
"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?


Yes, but I'm not at liberty to distribute it.

While you are waiting, Check out DIMARC.LSP at
http://www.turvill.com/t2/free_stuff/index.htm

It's not exactly what you are asking for, but it may do if you cannot find
just the right routine.
Message 6 of 9
Anonymous
in reply to: Anonymous

Try this. Maybe some lines got folded in the transmission.

rs

"Rich Banker" wrote in message
news:4835660@discussion.autodesk.com...
When I try to run it, I get the error message "error: malformed list on
input"

What does that mean, and is it possible to fix?

Thanks for your help, I really appreciate it!

Rich

"tcebob" wrote in message
news:4835343@discussion.autodesk.com...
Try this:

(defun c:darc( / osm ar arc rad pt1 pt2) ; Dim. Arc (for "R25'")
(setvar "peditaccept" 1)
(setq osm (getvar "osmode"))
(setvar "osmode" 512) ;near
(while
(setq ar(entsel "\nSelect an arc where you want to place the text: "))
(setq arc (entget (car ar)))
(if(member(cdr(assoc 0 arc))'("CIRCLE" "ARC"))
(progn
(setq rad (cdr(assoc 40 arc)))
(setq pt1 (cadr ar))
(setq pt2 (getpoint "\nPick a direction (NEAR)" ))
(if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
(command "text" "J" "bl" pt1 "" pt2 (strcat "R" (rtos rad 2 2)))
(command "text" "J" "bl" pt1 pt2 (strcat "R" (rtos rad 2 2)))
)
) ;progn
(princ "\nNot a CIRCLE or ARC")
) ;if
) ;while
(setvar "osmode" osm)

You can alter it to read L= . . .

rs

"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich
Message 7 of 9
Anonymous
in reply to: Anonymous

That works, but I needed it to label the length of the arc, not the radius.
Is it posible to modify that routine to do that.

I have little LISP programming experience...

Thanks for your help!

Rich


"tcebob" wrote in message
news:4835906@discussion.autodesk.com...
Try this. Maybe some lines got folded in the transmission.

rs

"Rich Banker" wrote in message
news:4835660@discussion.autodesk.com...
When I try to run it, I get the error message "error: malformed list on
input"

What does that mean, and is it possible to fix?

Thanks for your help, I really appreciate it!

Rich

"tcebob" wrote in message
news:4835343@discussion.autodesk.com...
Try this:

(defun c:darc( / osm ar arc rad pt1 pt2) ; Dim. Arc (f
or "R25'")
(setvar "peditaccept" 1)
(setq osm (getvar "osmode"))
(setvar "osmode" 512) ;near
(while
(setq ar(entsel "\nSelect an arc where you want to place the text: "))
(setq arc (entget (car ar)))
(if(member(cdr(assoc 0 arc))'("CIRCLE" "ARC"))
(progn
(setq rad (cdr(assoc 40 arc)))
(setq pt1 (cadr ar))
(setq pt2 (getpoint "\nPick a direction (NEAR)" ))
(if (= (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))) 0)
(command "text" "J" "bl" pt1 "" pt2
(strcat "R" (rtos rad 2 2)))
(command "text" "J" "bl" pt1 pt2 (strcat "R" (rtos rad 2 2)))
)
) ;progn
(princ "\nNot a CIRCLE or ARC")
) ;if
) ;while
(setvar "osmode" osm)

You can alter it to read L= . . .

rs

"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for a
ny help you can give!

Rich
Message 8 of 9
Anonymous
in reply to: Anonymous

I wrote this long ago, in an autocad far far away.

(defun c:dimlen (/ obj deg len)
(setq obj (entsel "\nSelect Arc: "))
(setq deg (* 180.0 (/ (- (cdr (assoc 51 (entget (car obj)))) (cdr (assoc 50
(entget (car obj))))) pi)))
(setq len (/ (* 2 pi (cdr (assoc 40 (entget (car obj)))) deg) 360))
(command ".dimangular" obj "t" (rtos len (getvar "dimunit") (getvar
"dimdec")) pause)
(princ)
)


"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich
Message 9 of 9
Anonymous
in reply to: Anonymous

Thanks Tim, I appreciate your help!

Rich


"Tim Decker" wrote in message
news:4837048@discussion.autodesk.com...
I wrote this long ago, in an autocad far far away.

(defun c:dimlen (/ obj deg len)
(setq obj (entsel "\nSelect Arc: "))
(setq deg (* 180.0 (/ (- (cdr (assoc 51 (entget (car obj)))) (cdr (assoc 50
(entget (car obj))))) pi)))
(setq len (/ (* 2 pi (cdr (assoc 40 (entget (car obj)))) deg) 360))
(command ".dimangular" obj "t" (rtos len (getvar "dimunit") (getvar
"dimdec")) pause)
(princ)
)


"Rich Banker" wrote in message
news:4835194@discussion.autodesk.com...
Does anyone have a lisp routine that will label the length of an arc and
place the annotation to read L=length' along the arc?

I'm using Autocad 2004.

Thanks for any help you can give!

Rich

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

Post to forums  

Autodesk Design & Make Report

”Boost