Have you ever thought about using the 'Batting' Linetype that comes with
AutoCAD. A while ago I wrote a lisp prog that did basically what your
wanting to do, but then found that a line was easier to work with, although
it is a bit limited when it comes to multiply views of the line with
different VP scales. Also because it isn't a polyline made up of hundreds of
little segments, the overall file size is smaller.
Hope this helps,
Chad.
BCM Architects <dav...@bcmarch.com.au> wrote in message
news:39862fee$0$26...@motown.iinet.net.au...
> Hi all
>
> I would appreciate it if anyone could help with the attached lisp,
> which draws insulation for architectural details. I need the output to
> be one polyline though, not an enormous number of segments. Is this
> possible/easy to do?
>
> Thanks in advance
> David M
>
>
>
Yes, definitely possible and fairly easy to do.
The trick is to add each segment to a selection set as it is drawn, then
use the PEDIT command at the end to join them all together.
I've added some lines to the lisp you posted to give you an idea of what
I mean (beware the line wrapping!).
Regards,
Doug Philip.
; insul.LSP Batt Insulation
; REV.1 - D. Philip - 2000-07-31
;
(defun newerr (NE)
(if (/= NE "Function cancelled")
(princ (strcat "\nError: " NE))
)
(if set1 (setq set1 nil) ) ;;; REV.1
(setvar "OSMODE" OM)
(setvar "CMDECHO" CE)
(setvar "BLIPMODE" BM)
(princ)
)
(defun c:insul
(/ SP EP HT OM CE BM DX AN NX NU AX PX
P1 P2 P3 P4 P5 P6 P7 P8 P9 XT)
(while (= SP nil) (setq SP
(getpoint "\nPick start point of insulation: ")))
(while (= EP nil) (setq EP
(getpoint "\nPick end point of insulation: ")))
(while (= HT nil) (setq HT
(getdist "\nPick or enter height of insulation: ")))
(setq OM (getvar "OSMODE")) (setvar "OSMODE" 0)
(setq CE (getvar "CMDECHO")) (setvar "CMDECHO" 0)
(setq BM (getvar "BLIPMODE")) (setvar "BLIPMODE" 0)
(setq CO (getvar "CECOLOR")) (setvar "CECOLOR" "1")
(setq DX (distance SP EP)
AN (angle SP EP)
NX (/ HT 2)
NU (/ DX NX)
AX (+ AN (/ pi 2))
PX (polar SP AX HT)
P1 (polar SP AX (/ HT 1.25))
P2 (polar P1 AN (/ HT 20))
P3 (polar P1 AN (/ HT 4))
P4 (polar P2 AN (/ HT 2.5))
P5 (polar SP AX (/ HT 5))
P6 (polar P5 AN (/ HT 5))
P7 (polar P6 AN (/ HT 10))
P8 (polar P5 AN (/ HT 2))
P9 (polar SP AN (/ HT 2))
)
(setq set1 (ssadd)) ;;; REV.1
(repeat (fix NU)
;;; (command ".ARC" "C" P5 SP P6 ".LINE" P6 P2 "" ".ARC" P2 "C"
;;; removed REV.1
;;; P3 "A" "-180" ".LINE" P4 P7 "" ".ARC" "C" P8 P7 P9) ;;;
removed REV.1
(command ".ARC" "C" P5 SP P6) (ssadd (entlast) set1) ;;; REV.1
(command ".LINE" P6 P2 "") (ssadd (entlast) set1) ;;; REV.1
(command ".ARC" P2 "C" P3 "A" "-180" ) (ssadd (entlast) set1)
;;; REV.1
(command ".LINE" P4 P7 "" ) (ssadd (entlast) set1) ;;; REV.1
(command ".ARC" "C" P8 P7 P9) (ssadd (entlast) set1) ;;; REV.1
(setq SP (polar SP AN NX)
P2 (polar P2 AN NX)
P3 (polar P3 AN NX)
P4 (polar P4 AN NX)
P5 (polar P5 AN NX)
P6 (polar P6 AN NX)
P7 (polar P7 AN NX)
P8 (polar P8 AN NX)
P9 (polar P9 AN NX)
)
)
(setq XT (distance SP EP))
(if (>= XT (/ HT 5))
;;; (command ".ARC" "C" P5 SP P6 ".LINE" P6 P2 "" ;;; removed
REV.1
;;; ".ARC" P2 "C" P3 "A" "-75") ;;; removed REV.1
(progn ;;; REV.1
(command ".ARC" "C" P5 SP P6 ) (ssadd (entlast) set1) ;;;
REV.1
(command ".LINE" P6 P2 "") (ssadd (entlast) set1) ;;; REV.1
(command ".ARC" P2 "C" P3 "A" "-75") (ssadd (entlast) set1)
;;; REV.1
) ; end of progn ;;; REV.1
)
(setq name1 (ssname set1 0)) ;;; REV.1
(command "_.PEDIT" name1 "_Y" "_JOIN" set1 "" "") ;;; REV.1
(setq set1 nil) ;;; REV.1
(setvar "OSMODE" OM)
(setvar "CMDECHO" CE)
(setvar "BLIPMODE" BM)
(setvar "CECOLOR" CO)
(princ)
);end
Cheers
David M
Chad <plo...@ozlinx.com.au> wrote in message
news:39865...@news.ausmail.com...
> Hi David,
>
> Have you ever thought about using the 'Batting' Linetype that comes
with
> AutoCAD. A while ago I wrote a lisp prog that did basically what your
> wanting to do, but then found that a line was easier to work with,
although
> it is a bit limited when it comes to multiply views of the line with
> different VP scales. Also because it isn't a polyline made up of
hundreds of
> little segments, the overall file size is smaller.
>
> Hope this helps,
> Chad.
>
> BCM Architects <dav...@bcmarch.com.au> wrote in message
> news:39862fee$0$26...@motown.iinet.net.au...
I see what you mean - works great and 100% more practical. Frustrating
though - I can follow your logic, but cannot seem to be able to learn
to apply the same myself. It would be great to be able to "whip up" a
LISP rather than cobble it together from other peoples code, or rely on
help etc. Still, old dogs and new tricks I suppose.
Thanks again
David m
Doug Philip <dgph...@telusplanet.net> wrote in message
news:398687...@telusplanet.net...
> BCM Architects wrote:
> >
> > Hi all
> >
> > I would appreciate it if anyone could help with the attached lisp,
> > which draws insulation for architectural details. I need the output
to
> > be one polyline though, not an enormous number of segments. Is
this
> > possible/easy to do?
> >
> > Thanks in advance
> > David M
> >
The LISP I wrote a few years ago was very crude, as I was just starting to
learn, and was made up of blocks of an insulation segment.
If I was doing it now, it would be very different. The way Doug (message
below) has done it would be more along the line of things.
And sorry, I deleted the file a while ago.
Cya, Chad
BCM Architects <dav...@bcmarch.com.au> wrote in message
news:398676ef$0$26...@motown.iinet.net.au...
> Thanks Chad - tried this, but with VPs at all different scales etc,
> all too hard!
> That LISP of yours, did it do a single polyline or a whole bunch of
> lines? If a single PL, and chance of a copy?
>
> Cheers
> David M
>
> Chad <plo...@ozlinx.com.au> wrote in message
> news:39865...@news.ausmail.com...
> > Hi David,
> >
> > Have you ever thought about using the 'Batting' Linetype that comes
> with
> > AutoCAD. A while ago I wrote a lisp prog that did basically what your
> > wanting to do, but then found that a line was easier to work with,
> although
> > it is a bit limited when it comes to multiply views of the line with
> > different VP scales. Also because it isn't a polyline made up of
> hundreds of
> > little segments, the overall file size is smaller.
> >
> > Hope this helps,
> > Chad.
> >
> > BCM Architects <dav...@bcmarch.com.au> wrote in message
> > news:39862fee$0$26...@motown.iinet.net.au...
Don't get down on yourself David, it's just something you have to work
at. (old dogs & young pups alike!)
Like most things in our trade, it is largely a matter of experience and
practice. I took a course in autolisp and I've been practicing with it
pretty much constantly for the last 3 years or so, and I still discover
new ways to do things regularly.
And even the most experienced of us has to ask for help and hints once
in a while.
One of the nice things about practice is that besides helping you learn,
you also begin to build up a "portfolio" (can't think of better word) of
code that you can reuse and adapt.
Perfect example is the code I modified for you. The (ssadd...) and
PEDIT parts I added to your routine were recycled from a routine to draw
roller chain sprockets. It only takes me five or ten minutes to
recycle, but it may have taken me a day and several rewrites to think of
it in the first place (this of course is where the experience part is...
"oh yeah, I had to do that before...").
Well enough of the pep talk. As my dear aunt says to me "Sometimes you
just need a pat on the back and a kick in the ass." And laddy, now that
you've got your pat on the back... ;)
Regards,
Doug Philip.
as with everything practice makes perfect, we've all just got to
prioritise what we really want to practice at I s'pose!
Cheers
David M
Doug Philip <dgph...@telusplanet.net> wrote in message
news:3987CD...@telusplanet.net...