Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Rich Banker
Message 1 of 9 (81 Views)

Arc Length

81 Views, 8 Replies
05-04-2005 02:44 PM
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
*R.K. McSwain
Message 2 of 9 (81 Views)

Re: Arc Length

05-04-2005 03:58 PM in reply to: *Rich Banker
"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.
*tcebob
Message 3 of 9 (81 Views)

Re: Arc Length

05-04-2005 04:47 PM in reply to: *Rich Banker
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
*Rich Banker
Message 4 of 9 (81 Views)

Re: Arc Length

05-05-2005 06:03 AM in reply to: *Rich Banker
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
*Rich Banker
Message 5 of 9 (81 Views)

Re: Arc Length

05-05-2005 06:06 AM in reply to: *Rich Banker
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.
*tcebob
Message 6 of 9 (81 Views)

Re: Arc Length

05-05-2005 08:22 AM in reply to: *Rich Banker
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
*Rich Banker
Message 7 of 9 (81 Views)

Re: Arc Length

05-05-2005 11:27 AM in reply to: *Rich Banker
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
*Tim Decker
Message 8 of 9 (81 Views)

Re: Arc Length

05-06-2005 06:14 AM in reply to: *Rich Banker
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
*Rich Banker
Message 9 of 9 (81 Views)

Re: Arc Length

05-06-2005 06:26 AM in reply to: *Rich Banker
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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.