Trouble with an offset lisp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Having some trouble with some code previously made by BeeKeeCZ here .
The trouble I am having is that the offset command is really not liking the osp point in some instances, making me use the Changepoint to clear the osp variable. I have been trying to set up an using userdefined *error* but i don't think it is technically an error. System var errno keeps showing 0 right after I fail to put a line for offset. The only thing I see that even comes close to an error message is "Cannot offset that object." when trying to offset a AECC_PARCEL_SEGMENT in the conditions stated above. Any ideas? Thanks in advance!!
P.S. I know the way I set up initget is a little wierd, but it was the only way i could get the program to work the way I wanted it to, if anyone can school me on how to set a cond that can shorten that up I would love that too. thanks!!
(defun c:oof ( / ensel dist done osp) (or esmtlist (setq esmtlist (ssadd))) (while (not done) (or dist (setq dist (cond ((getdist (strcat "\nEnter Distance to offset: [Enter to accept: <" (rtos (setq dist (getvar 'Offsetdist)) 2 2) ">: " ) ) ) (dist) ))) ;;(getdist "\nSpecify distance of offset: "))) (setvar 'ERRNO 0) (initget "5 6 7 7.5 10 12 15 20 25 30 33 35 40 45 50 60 66 70 75 80 90 100 120 140 150 Distance Changepoint Boundary") (setq ensel (entsel (strcat "\nSelect object to offset, offset distance or <Distance> <Changepoint> Current offset distance <"(rtos dist)">: "))) ;; hit enter to end (cond ((= ensel "5") ;; set distance (setq dist (distof ensel))) ((= ensel "6") ;; set distance (setq dist (distof ensel))) ((= ensel "7") ;; set distance (setq dist (distof ensel))) ((= ensel "7.5") ;; set distance (setq dist (distof ensel))) ((= ensel "10") ;; set distance (setq dist (distof ensel))) ((= ensel "12") ;; set distance (setq dist (distof ensel))) ((= ensel "15") ;; set distance (setq dist (distof ensel))) ((= ensel "20") ;; set distance (setq dist (distof ensel))) ((= ensel "25") ;; set distance (setq dist (distof ensel))) ((= ensel "30") ;; set distance (setq dist (distof ensel))) ((= ensel "33") ;; set distance (setq dist (distof ensel))) ((= ensel "35") ;; set distance (setq dist (distof ensel))) ((= ensel "40") ;; set distance (setq dist (distof ensel))) ((= ensel "45") ;; set distance (setq dist (distof ensel))) ((= ensel "50") ;; set distance (setq dist (distof ensel))) ((= ensel "60") ;; set distance (setq dist (distof ensel))) ((= ensel "66") ;; set distance (setq dist (distof ensel))) ((= ensel "70") ;; set distance (setq dist (distof ensel))) ((= ensel "75") ;; set distance (setq dist (distof ensel))) ((= ensel "80") ;; set distance (setq dist (distof ensel))) ((= ensel "90") ;; set distance (setq dist (distof ensel))) ((= ensel "100") ;; set distance (setq dist (distof ensel))) ((= ensel "120") ;; set distance (setq dist (distof ensel))) ((= ensel "140") ;; set distance (setq dist (distof ensel))) ((= ensel "150") ;; set distance (setq dist (distof ensel))) ((= ensel "Distance") ;; set distance (setq dist nil)) ((= ensel "Changepoint") ;; set point (setq osp nil)) ((= ensel "Boundary") ;; boundary set (c:boo)) ((and (not ensel) ;; ended by enter (eq (getvar 'ERRNO) 52)) (setq done T)) ((not ensel)) ;; missed ((not (wcmatch (cdr (assoc 0 (entget ( car ensel)))) "LINE,AECC_PARCEL_SEGMENT,LWPOLYLINE"))) ;; selected anything but AECC_PARCEL_SEGMENT,LINE,LWPOLYLINE (ensel ;; correct selection (or osp (setq osp (getpoint "\nSpecify point on side to offset multiple lines: "))) (command) (command "_.OFFSET" dist (car ensel) osp "") ;;;;;; while "Cannot offset that object." I would like to keep reseting the osp till it finds one it like.;;;;;; (ssadd (entlast) esmtlist) ) ) ) (princ) ) (defun c:boo(/) (command "PEDIT" "M" esmtlist "" "J" "100" "" ) )