Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Making older LISP routine work in AutoCad Map

44 views
Skip to first unread message

Randy Williamson

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
I wrote this routine years ago to automate changing widths of polylines:

(defun c:p10 (/ ss i)
(setq ss (ssget))
(setq i 0)
(repeat (sslength ss)
(setq e (ssname ss i))
(if (= (cdr (assoc 0 (entget e))) "POLYLINE")
(command "pedit" e "w" "10" "x")
)
(setq i (1+ i))
)
(princ)
)
(princ "\nType p10 to invoke command.")
(princ)

Start the routine, pick the lines you want changed, and away it goes!

You can change the variables for the line width you want within the routine
or make a copy. I never did get back to change it to make the line width an
input variable. Maybe some day.

The problem I'm having is that it will not work consistantly in AutoCad
Map.

After a line is given a width, the routine stops working. It appears to run,
but does not change the widths anymore.

I'd appreciate any help.

Randy Williamson
GIS Co-ordinator
Palliser Municipal Services
Hanna, Alberta
ra...@telusplanet.net

Silvia Soonets

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
In the bonus menu ,the mpedit command do what you want.

Randy Williamson escribió:

Rudy Tovar

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
Hello Randy, I'm Rudy.

I had the same problem with my function.

So I modified it to work with R14.

Here's the code.

;; This is function will modify plines, lines, arcs, and lwploylines
;; ============================================


(defun c:THK (/ Gwidth Groups Group-len Cnt Ent Ent-inf Ent-nam Ent-asc
Ent-han Ent-typ)

(prompt "\nSelect Entities...")
(setq Groups (ssget))

(setq Gwidth (getvar "offsetdist"))

(if Groups
(progn
(setq Group-len (sslength Groups))
(setq Cnt 0)
(prompt (strcat "\nEnter Line Width <" (rtos Gwidth 4 2)))
(setq Gwidth (getdist ">: "))
(if Gwidth (setvar"offsetdist" Gwidth))
(if (= Gwidth nil)(setq Gwidth (getvar "offsetdist")))
(setq Gwidth (abs Gwidth))

(repeat Group-len

(setq Ent (ssname Groups Cnt))
(setq Cnt (+ Cnt 1))
(setq Ent-inf (entget Ent))
(setq Ent-typ (cdr (assoc 0 Ent-inf)))
(setq Ent-nam (cdr (assoc -1 Ent-inf)))
(setq Ent-asc (cdr (assoc 10 Ent-inf)))
(setq Ent-han (list Ent-nam Ent-asc))

(cond
((= Ent-typ "LWPOLYLINE" )(command "pedit" Ent-han "w"
Gwidth "x"))
((= Ent-typ "POLYLINE" ) (command "pedit" Ent-han "w" Gwidth
"x"))
((= Ent-typ "LINE" ) (command "pedit" Ent-han "y" "w" Gwidth
"x"))
((= Ent-typ "PLINE") (command "pedit" Ent-han "w" Gwidth
"x"))
((= Ent-typ "ARC" ) (command "pedit" Ent-han "y" "w" Gwidth
"x"))
)

)

)
)
(princ)
)


--
Ru...@whainc.com
Programmer/Developer/MIS Assist.

Randy Williamson <ra...@telusplanet.net> wrote in article
<7q13ab$e7...@adesknews2.autodesk.com>...

Cliff DuHaime

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
Would it help if "e" were included in your local variable list? Just a thought.


Ian Bryant

unread,
Sep 24, 1999, 3:00:00 AM9/24/99
to
No!!!
The program is only looks for POLYLINES, it should also check for
LWPOLYLINE, LINES etc. as in RUDY's example.
Forget about local variables, as soon as a user cancels a function or
the function beaks on error, all the local variables become global
variables.
It is best to keep this in mind and try to allow for it in your programs.
Regards Ian
Cliff DuHaime wrote in message <37C4980D...@megahits.com>...
0 new messages