| Author |
Message |
Chris
Guest
|
Posted:
Wed Oct 12, 2005 4:10 pm Post subject:
Offset |
|
|
Does anyone know of a way to offset a large group of items in a drawings.
Say you have a drawing with 50 circles and you need to offset them is there
a command, lisp or shx that will do this? I found a lisp called offset all
but it doesn't let you offset more than one item at a time.
|
|
| Back to top |
|
 |
Paul Turvill
Guest
|
Posted:
Wed Oct 12, 2005 8:10 pm Post subject:
Re: Offset |
|
|
I suppose it could be handled by LISP, but it isn't exactly a trivial
undertaking, since each offset requires a selection of an item, plus a pick
to indicate on which side the offset object is to be placed.
In your example of circles, I suppose the routine could ask for a distance
and a choice of "inside" or "outside" ... and treat all of the circles
similarly. Is this what you have in mind? Would you need to consider other
types of objects as well? If so, the problem becomes increasingly complex.
___
"Chris" <chris@myemail.com> wrote in message
news:Xns96ED690A55AA8ChrisWaterjet@207.115.17.102...
[quote]Does anyone know of a way to offset a large group of items in a drawings.
Say you have a drawing with 50 circles and you need to offset them is
there
a command, lisp or shx that will do this? I found a lisp called offset all
but it doesn't let you offset more than one item at a time.[/quote] |
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Wed Oct 12, 2005 8:10 pm Post subject:
Re: Offset |
|
|
"Paul Turvill" <nospam@turvill.com> wrote in
news:dijhuf$59b$1@domitilla.aioe.org:
[quote]I suppose it could be handled by LISP, but it isn't exactly a trivial
undertaking, since each offset requires a selection of an item, plus a
pick to indicate on which side the offset object is to be placed.
In your example of circles, I suppose the routine could ask for a
distance and a choice of "inside" or "outside" ... and treat all of
the circles similarly. Is this what you have in mind? Would you need
to consider other types of objects as well? If so, the problem becomes
increasingly complex. ___
"Chris" <chris@myemail.com> wrote in message
news:Xns96ED690A55AA8ChrisWaterjet@207.115.17.102...
Does anyone know of a way to offset a large group of items in a
drawings. Say you have a drawing with 50 circles and you need to
offset them is there
a command, lisp or shx that will do this? I found a lisp called
offset all but it doesn't let you offset more than one item at a
time.
That's about what Im looking for. I have a plasma cutting table here at[/quote]
the shop I work at and we need to offset holes .125 to compensate for
the cut. Say I have an array of 50 holes I just want to be able to
select them all, choose the distance and to which direction and erase or
put the original on a different layer.
|
|
| Back to top |
|
 |
Brian Salt
Guest
|
Posted:
Wed Oct 12, 2005 10:45 pm Post subject:
Re: Offset |
|
|
In article <Xns96ED8C04B4367ChrisWaterjet@207.115.17.102>,
chris@myemail.com (Chris) wrote:
[quote]*From:* Chris <chris@myemail.com
*Date:* Wed, 12 Oct 2005 18:37:41 GMT
That's about what Im looking for. I have a plasma cutting table here at
the shop I work at and we need to offset holes .125 to compensate for
the cut. Say I have an array of 50 holes I just want to be able to
select them all, choose the distance and to which direction and erase
or put the original on a different layer.
[/quote]
If the holes are all the same radius, perhaps this (or something similar)
would fit the bill. Note that there are two versions quoted.
I have tried the first routine as it stands and it does change all the
holes with the specified radius to the newly defined radius. I haven't
checked the second routine.
Brian.
;|
********************************************
* CHRAD.LSP - (c) 1998 Tee Square Graphics *
********************************************
Two utilities to globally change the radius of existing
circles in an AutoCAD drawing.
CAUTION: This is "demonstration" level software, and has no
error traps or other refinements. These enhancements are
left to the discretion of the end user. Both of the commands
defined below will select ALL circles of the chosen "old
radius" and change all to the "new radius." To allow the
user to select a superset of objects to be scanned, remove
the "x" from the (ssget...) function in either case:
(setq ss (ssget (list '(0 . "CIRCLE")(cons 40 or))))
********************************************
CHRAD command uses (command...) function and appears to be
somewhat faster where the change of radius is fairly small.
|;
(defun C:CHRAD (/ or nr ss)
(setq ce (getvar "cmdecho")
or (getdist "\nOld radius: ")
nr (getdist "\nNew radius: ")
ss (ssget "x" (list '(0 . "CIRCLE")(cons 40 or))))
(if ss
(progn
(setvar "cmdecho" 0)
(command "_.change" ss "" "" nr)
(while (= (logand (getvar "cmdactive") 1) 1)
(command nr))
(setvar "cmdecho" ce))
(alert (strcat "No " (rtos or) " radius circles found.")))
(princ)
)
;|
********************************************
CHRAD1 command uses (entmod...) and is considerably
faster where the change of radius is large.
|;
(defun C:CHRAD1 (/ or nr ss n obj)
(setq or (getdist "\nOld radius: ")
nr (getdist "\nNew radius: ")
ss (ssget "x" (list '(0 . "CIRCLE")(cons 40 or)))
n 0)
(if ss
(while (< n (sslength ss))
(setq obj (entget (ssname ss n))
obj (subst (cons 40 nr)(assoc 40 obj) obj)
n (1+ n))
(entmod obj))
(alert (strcat "No " (rtos or) " radius circles found.")))
(princ)
) |
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Thu Oct 13, 2005 12:10 am Post subject:
Re: Offset |
|
|
in my original post I meant arx not shx, I was working with text stuff at
the time.
[quote]
"Chris" <chris@myemail.com> wrote in message
news:Xns96ED690A55AA8ChrisWaterjet@207.115.17.102...
Does anyone know of a way to offset a large group of items in a
drawings. Say you have a drawing with 50 circles and you need to
offset them is there
a command, lisp or shx that will do this? I found a lisp called
offset all but it doesn't let you offset more than one item at a
time.[/quote] |
|
| Back to top |
|
 |
Paul Turvill
Guest
|
Posted:
Thu Oct 13, 2005 5:49 am Post subject:
Re: Offset |
|
|
(defun C:OFFCIR (/ n os io dat orad nrad ndat)
(while (not (setq ss (ssget '((0 . "CIRCLE"))))))
(setq n (1- (sslength ss))
os (getdist "\nEnter offset distance: ")
);;setq
(initget "Inside Outside")
(setq io (getkword "\nInside or Outside <O>?"))
(while (>= n 0)
(setq dat (entget (ssname ss n))
orad (cdr (assoc 40 dat))
nrad (if (= io "Inside")(- orad os)(+ orad os))
ndat (subst (cons 40 nrad)(assoc 40 dat) dat)
n (1- n)
);;setq
(entmake ndat)
);;while
;;Select the line below to do what you wish
;; with the original circles:
; (command "_.erase" ss "")
; (command "_.chprop" ss "" "_la" "[LayerName]" "")
(princ)
);;defun
___
"Chris" <chris@myemail.com> wrote in message
news:Xns96ED8C04B4367ChrisWaterjet@207.115.17.102...
[quote]"Paul Turvill" <nospam@turvill.com> wrote in
news:dijhuf$59b$1@domitilla.aioe.org:
That's about what Im looking for. I have a plasma cutting table here at
the shop I work at and we need to offset holes .125 to compensate for
the cut. Say I have an array of 50 holes I just want to be able to
select them all, choose the distance and to which direction and erase or
put the original on a different layer.[/quote] |
|
| Back to top |
|
 |
Adesu
Joined: 20 Jul 2005
Posts: 31
|
Posted:
Thu Oct 13, 2005 8:30 am Post subject:
Re: Offset |
|
|
Hi Chris, as alternative for offset alls circle,here code
| Code: |
(defun c:oc ()
(if
(setq ss (ssget "x" '((0 . "CIRCLE"))))
(progn
(setq cnt 0)
(setq ssl (sslength ss))
(initget "I O")
(setq opt (getkword "\nSelect offset [(I)nside/(O)utside]<O>: "))
(repeat ssl
(setq ssn (ssname ss cnt))
(setq sse (entget ssn))
(setq cp (cdr (assoc 10 sse)))
(setq rad (cdr (assoc 40 sse)))
(if (= opt nil)(setq opt "O"))
(if
(= opt "O")
(progn
(setq dis (* rad 0.25))
(setq pt (polar cp 0 (+ rad (* rad 0.5))))
(command "_offset" dis ssn pt "")
) ; progn
(progn
(setq dis (* rad 0.25))
(setq pt (polar cp 0 (- rad (* rad 0.5))))
(command "_offset" dis ssn pt "")
) ; progn
) ; if
(setq cnt (1+ cnt))
) ; repeat
) ; progn
(alert "\nInvalid selected object,please try again")
) ; if
(princ)
) ; defun
|
| Chris wrote: | in my original post I meant arx not shx, I was working with text stuff at
the time.
| Quote: |
"Chris" <chris@myemail.com> wrote in message
news:Xns96ED690A55AA8ChrisWaterjet@207.115.17.102...
Does anyone know of a way to offset a large group of items in a
drawings. Say you have a drawing with 50 circles and you need to
offset them is there
a command, lisp or shx that will do this? I found a lisp called
offset all but it doesn't let you offset more than one item at a
time. |
|
|
|
| Back to top |
|
 |
Brian Salt
Guest
|
Posted:
Thu Oct 13, 2005 10:27 am Post subject:
Re: Offset |
|
|
That works very well, Paul.
In article <dikau7$c4m$1@domitilla.aioe.org>, nospam@turvill.com (Paul
Turvill) wrote:
| Quote: | *From:* "Paul Turvill" <nospam@turvill.com
*Date:* Wed, 12 Oct 2005 17:49:15 -0700
(defun C:OFFCIR (/ n os io dat orad nrad ndat)
(while (not (setq ss (ssget '((0 . "CIRCLE"))))))
(setq n (1- (sslength ss))
os (getdist "\nEnter offset distance: ")
);;setq
(initget "Inside Outside")
(setq io (getkword "\nInside or Outside <O>?"))
(while (>= n 0)
(setq dat (entget (ssname ss n))
|
<SNIP> |
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Thu Oct 13, 2005 4:10 pm Post subject:
Re: Offset |
|
|
Paul you rule. That works great. I need to learn how to write those
programs but I have only been using CAD for about 6 months. Thanks again
this helps bigtime. |
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Thu Oct 13, 2005 4:10 pm Post subject:
Re: Offset |
|
|
Chris <support@aol.com> wrote in news:Xns96EE58AF2551DChrisWaterjet@
207.115.17.102:
| Quote: | Paul you rule. That works great. I need to learn how to write those
programs but I have only been using CAD for about 6 months. Thanks again
this helps bigtime.
One more thing, I thought I saw it in the lisp but when I ran the offset
there wasn't a prompt to erase the originals. |
|
|
| Back to top |
|
 |
Paul Turvill
Guest
|
Posted:
Thu Oct 13, 2005 4:10 pm Post subject:
Re: Offset |
|
|
Look closely; the code provides for both options you mentioned, near the
end. Just remove the ";" at the start of the appropriate line. If you use
the "chprop" option to move the original circles to a new layer, you'll also
have to supply the actual layer name in place of "[LayerName]".
___
"Chris" <support@aol.com> wrote in message
news:Xns96EE5A16530C9ChrisWaterjet@207.115.17.102...
| Quote: | I thought I saw it in the lisp but when I ran the offset
there wasn't a prompt to erase the originals.
|
|
|
| Back to top |
|
 |
Chris
Guest
|
Posted:
Thu Oct 13, 2005 8:10 pm Post subject:
Re: Offset |
|
|
"Paul Turvill" <nospam@turvill.com> wrote in
news:dim0m9$7ti$1@domitilla.aioe.org:
| Quote: | Look closely; the code provides for both options you mentioned, near
the end. Just remove the ";" at the start of the appropriate line. If
you use the "chprop" option to move the original circles to a new
layer, you'll also have to supply the actual layer name in place of
"[LayerName]". ___
"Chris" <support@aol.com> wrote in message
news:Xns96EE5A16530C9ChrisWaterjet@207.115.17.102...
I thought I saw it in the lisp but when I ran the offset
there wasn't a prompt to erase the originals.
|
Got ya. Works perfectly. Thanks alot. |
|
| Back to top |
|
 |
|
|
|
|