Jump to content

Recommended Posts

Posted

Sorry if this has been all ready been dealt with but I couldn't find anything specific when I did a search.

Using AC2008

Would like to be able to draw a box (boundary) over a drawing that consists of lines, polylines etc. and be able to delete everything outside the box. That means the polylines and lines etc. would be broken at the boundary and deleted

 

The drawings are of towns, which show all the house boundrys, roads and main service infrastructure (water, sewer, etc.) but I only need to work on 1 or 2 streets not the whole town.

 

I know i can trim and extend and break the lines but it would be so cool to be able to do it in one comand

 

 

 

Thanks in Advance

HenryJohn

Posted

Try the Express Tools command "extrim", should handle that.

Posted

not bad, but when I run extrim not all of the lines are deleted only some of them.

Am I doing something wrong???

Posted

If the object you're trying to trim isn't a continuous linetype, and a 'space' happens to land on the trim boundary, it won't trim. Also, I find that the results of the extrim command are iffy.

Posted

You can set ltscale real small before running it to hopefullay avoid most "broken line" problems with it. An inconvenience, but for infrequent use, BTN.

Posted

give this a try. it needs some error trapping to make it solid but you can get the idea. i took the front end of the express tools extended trim program and made it accept 2 arguments 1- entity name of rectangel and the corner point of the rectangle. then it will use the rest of the express tool extend trim program, so therefore this will only work if you have expresstools installed.

load it up and type test on the command line

 

(defun c:test (/ rect llc urc )

(setq rect(car(entsel"\n Select Rectangle or Closed Polyline")));_get rectangle

(vla-GetBoundingBox (vlax-ename->vla-object rect) 'minpt 'maxpt);_check for heigth /width

(setq

llc (vlax-safearray->list minpt)

urc (vlax-safearray->list maxpt)

);_setq

(extrim2 rect llc);_call to extended trim pass ent name and point

(command "erase" "all" "r" "w" urc llc "");_erase everything outside the rectangle

(princ)

);_defun

;;; borrow from expresstools extended trim code and make it work for this

(defun extrim2 (ag1 ag2 / na e1 p1 redraw_it lst n )

(acet-error-init (list

(list "cmdecho" 0

"highlight" 0

"regenmode" 1

"osmode" 0

"ucsicon" 0

"offsetdist" 0

"attreq" 0

"plinewid" 0

"plinetype" 1

"gridmode" 0

"celtype" "CONTINUOUS"

"ucsfollow" 0

"limcheck" 0

)

T ;flag. True means use undo for error clean up.

'(if redraw_it (redraw na 4))

);list

);acet-error-init

(setq na ag1)

(if na

(progn

(setq e1 (entget na));;setq

(if (or (equal "TEXT" (cdr (assoc 0 e1)))

(equal "MTEXT" (cdr (assoc 0 e1)))

(equal "ATTDEF" (cdr (assoc 0 e1)))

(equal "IMAGE" (cdr (assoc 0 e1)))

(equal "INSERT" (cdr (assoc 0 e1)))

(equal "SOLID" (cdr (assoc 0 e1)))

(equal "3DFACE" (cdr (assoc 0 e1)))

(equal "TRACE" (cdr (assoc 0 e1)))

);or

(progn

(setq lst (acet-geom-object-point-list na nil))

(setq n 0)

(command "_.pline")

(repeat (length lst)

(command (nth n lst))

(setq n (+ n 1));setq

);repeat

(if (not (equal (car lst) (last lst) 0.0000001))

(command "_cl")

(command "")

);if

(setq na (entlast)

e1 na

);setq

);progn then draw a temp pline to be the cutting edge.

(setq e1 nil)

);if

(redraw na 3)

(setq redraw_it T)

(setq p1 ag2)

(redraw na 4)

(setq redraw_it nil)

(if p1 (etrim na p1));if

(if e1

(progn

(if (setq p1 (acet-layer-locked (getvar "clayer")))

(command "_.layer" "_un" (getvar "clayer") "")

);if

(entdel e1)

(if p1

(command "_.layer" "_lock" (getvar "clayer") "")

);if

);progn then

);if

);progn

);if

(acet-error-restore)

(princ)

);defun c:extrim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...