Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Erasing everything outside a boundary

  1. #11
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Erasing everything outside a boundary

    azarko,
    Thank you very much. You have been a great help.
    Thank you other for your efforts.

    Stephen

  2. #12
    Woo! Hoo! my 1st post
    Join Date
    2019-03
    Posts
    1
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    Hello,
    I am trying to adapt the code to search polylines inside polylines that are crossing its limits and then trim that pieces off. But, for some reason isn't working out.
    Help!
    ; Trim selected objects outside a closed poly -
    ;(requires Express Tools!)
    ; adapted Maio 19 by Zucco
    ; original file
    ;
    ;
    ;

    Code:
    (vl-load-com)
    (defun c:Trim_Outer ()
    	(setq cmde (getvar "CMDECHO"))
    	(setvar "CMDECHO" 0)
    	(command "_UNDO" "_Group")
    
    	(initget 1 "ED TEMP FRONT")
    	(setq ED_layer (getkword "\nEscolha a Classe da edificação [ED/TEMP/FRONT]: "))
    	(if (= ED_layer "ED")
    		(setq ED_layer "ED_TEMP")
    	)
    	(if (= ED_layer "TEMP")
    		(setq ED_layer "UP_TEMP")
    	)
    	(if (= ED_layer "FRONT")
    		(setq ED_layer "UP_FRONT")
    	)
    
    	;(setq entLR (car (entsel "\nSelect Limite ou borda: ")))
    
    	;(setq ssLotes (ssget "_CP" (mapcar 'cdr (vl-remove-if-not '(lambda (item) (= (car item) 10)) (entget entLR)))
    	;						   (list (cons 0 "*POLYLINE" )(cons 8 "*LOTES_FISICOS" )(cons 410 "Model")))) 
    	(setq ssLotes (ssget "_X" (list (cons 0 "*POLYLINE" )(cons 8 "*LOTES_FISICOS*")(cons 410 "Model")))) 
    	(if (not (equal ssLotes nil)) (setq LTqtd (sslength ssLotes)) (setq LTqtd 0))
    	(while (> (setq LTqtd (1- LTqtd)) -1)
    		(setq entLT (ssname ssLotes LTqtd))
    		;(setq objLT (vlax-ename->vla-object entLT))
    
    		(setq cbox (ACET-ENT-GEOMEXTENTS entLT))
    		(setq cbox (mapcar '(lambda(x)(trans x 0 1)) cbox))
    		(setq lst (ACET-GEOM-OBJECT-POINT-LIST entLT 1e-4))
    		(ACET-SS-ZOOM-EXTENTS (ACET-LIST-TO-SS (list entLT)))
    		(command "_.ZOOM" "0.95x")
    		(if (null etrim)
    			(load "extrim.lsp")
    		)
    		(etrim entLT (polar (car cbox)
    				  (angle (car cbox)(cadr cbox))
    				  (* (distance (car cbox)(cadr cbox)) 1.1)))
    		
    		(setq e1 nil
    			  ssEdif nil)
    		(if (and
    				(setq ssBord (ssget "_CP" lst
    										  (list (cons 0 "*POLYLINE")(cons 8 ED_layer)(cons 410 "Model")) ))
    				(setq ssEdif (ssget "_CP" (mapcar 'cdr (vl-remove-if-not '(lambda (item) (= (car item) 10)) (entget entLT)))
    										  (list (cons 0 "*POLYLINE")(cons 8 ED_layer)(cons 410 "Model"))))
    			)
    		(progn
    			(setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ssBord))))
    			(foreach e1 lst 
    				(ssdel e1 ssEdif) ; Deletes an object (entity) from a selection set
    			)
    			(ACET-SS-ENTDEL ssEdif)
    
    			(setq ssEdif (ssget "_CP" (mapcar 'cdr (vl-remove-if-not '(lambda (item) (= (car item) 10)) (entget entLT)))
    									  (list (cons 0 "*POLYLINE")(cons 8 ED_layer)(cons 70 0)(cons 410 "Model"))))
    			(if (not (equal ssEdif nil)) (setq EDqtd (sslength ssEdif)) (setq EDqtd 0))
    			(while (> (setq EDqtd (1- EDqtd)) -1)
    				(setq entED (ssname ssEdif EDqtd))
    				(setq objED (vlax-ename->vla-object entED))
    				(vlax-put-property objED 'Closed 1)
    			) ; end while
    		)) ; end progn & if		
    	) ;end while
    	(setvar "cmddia" 1)
    	(setvar 'osmode os)
    	(setvar "cmdecho" 1)
    	(princ)	
    	(gc)
    ) ; end defun
    Thanks in advance.
    Last edited by rkmcswain; 2019-05-10 at 02:43 PM. Reason: added [CODE] tags

  3. #13
    I could stop if I wanted to
    Join Date
    2003-07
    Posts
    324
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    Have a look at my answer over at Cadtutor or Autodesk forums. Using offset and trim is way faster than using extrim.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 0
    Last Post: 2012-03-29, 05:35 AM
  2. When erasing hatch boundary goes also.
    By jsnow in forum AutoCAD General
    Replies: 5
    Last Post: 2007-01-10, 08:17 AM
  3. erasing titles
    By tect75 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2006-03-20, 03:28 PM
  4. Erasing a selection set name
    By Coolmo in forum VBA/COM Interop
    Replies: 10
    Last Post: 2004-08-26, 09:17 PM
  5. Phase Erasing?
    By gregcashen in forum Revit Architecture - General
    Replies: 5
    Last Post: 2003-09-18, 07:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •