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.

Reply to
Chris
Loading thread data ...

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. ___

Reply to
Paul Turvill

"Paul Turvill" wrote in news:dijhuf$59b$ snipped-for-privacy@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.

Reply to
Chris

in my original post I meant arx not shx, I was working with text stuff at the time.

Reply to
Chris

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) )

Reply to
Brian Salt

(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 ?")) (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 ___

Reply to
Paul Turvill

That works very well, Paul.

Reply to
Brian Salt

Hi Chris, as alternative for offset alls circle,here cod

(defun c:oc (

(i (setq ss (ssget "x" '((0 "CIRCLE"))) (prog (setq cnt 0 (setq ssl (sslength ss) (initget "I O" (setq opt (getkword "\nSelect offse [(I)nside/(O)utside] ") (repeat ss (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") (i (= opt "O" (prog (setq dis (* rad 0.25) (setq pt (polar cp 0 (+ rad (* ra

0.5))) (command "_offset" dis ssn pt "" ) ; prog (prog (setq dis (* rad 0.25) (setq pt (polar cp 0 (- rad (* ra 0.5))) (command "_offset" dis ssn pt "" ) ; prog ) ; i (setq cnt (1+ cnt) ) ; repea ) ; prog (alert "\nInvalid selected object,please tr again" ) ; i (princ ) ; defu

in my original post I meant arx not shx, I was working with tex stuff at

Reply to
Adesu

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.

Reply to
Chris

Chris wrote in news:Xns96EE58AF2551DChrisWaterjet@

207.115.17.102:

there wasn't a prompt to erase the originals.

Reply to
Chris

They are erases automatically if you take the semicolon out of this line:

; (command "_.erase" ss "")

to read:

(command "_.erase" ss "")

Reply to
Brian Salt

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]". ___

Reply to
Paul Turvill

"Paul Turvill" wrote in news:dim0m9$7ti$ snipped-for-privacy@domitilla.aioe.org:

Got ya. Works perfectly. Thanks alot.

Reply to
Chris

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.