Hi all, Have any one tried using 'Mapbreak' (Autodesk Map) command in programs for clipping (huge) drawings based on the overlying polygons? I have tried it, but because of a potential source of selection set builder error (as I have felt), the program fails after a certain number of iterations. In my case, after the program executes for around 50 to 60 polygons, it fails because of selection set exceeded the maximum number error. My code that performs this task is as below. Could anyone correct me if i am wrong? Can I get other ideas on clipping (including cutting features at boundaries) huge drawings based on the polygon shapes? Thanks, MNRaghu ;part of the main code that clips is as follows ;get selection set of polygon features that is used for clipping (setq sset (ssget "x" (list (cons 0 "POLYLINE")(cons 70 1)(cons 8 "polygons"))) ;polygons is the layer name (setq no 0);initialise counter (while (setq snam (ssname sset no)) (setq verts (espt snam)) ;get the vertex details (setq blst (GE_GetObjectBoundingBox snam)) ;get the bounding box of the polygon to zoom (command "zoom" "w" (car blst) (nth 2 blst)) ;zoom to the polygon area (if (setq cset (ssget "cp" verts (list (cons 8 OTHERLAYERS)))) ;otherlayers is a string of multiple layer names (progn (command "mapbreak" "S" snam "" "Y" OTHERLAYERS "y" cset "" "y" "y");break the features at the boundary edges (if (setq parset (ssget "wp" blst (list (cons 8 OTHERLAYERS))));get all features within the boundary (progn ;export this selection set as a drawing (command "-wblock" (strcat (getvar "dwgprefix") (itoa no) "_lbase.dwg") "" (getvar "insbase") parset snam "" "n") (setq parset nil) ) ) (setq cset nil) ) ) (setq no (1+ no)) ) (setq sset nil) *************************************************************************** ;; ! Function : Returns the object bounding box coordinates in the form of a ;; ! list of Lower Left and Upper Right points. ;; ! Arguments: 'ename' - Object to examine ;; ! Returns : 'Lst' - is a list of LL and UR ;; ! Updated : April 28, 2000 ;; ! Comments : VL-function, works with AutoCAD 2000 only ;; ! Copyright: (C) 2000, Four Dimension Technologies, Singapore ;; ! Contact : for help/support/info (defun GE_GetObjectBoundingBox(ename / ll ur vname ) (setq vname (vlax-ename->vla-object ename)) (vla-GetBoundingBox vname 'll 'ur) (setq ll (vlax-safearray->list ll) ur (vlax-safearray->list ur) ) (vlax-release-object vname) (list ll ur) ) ;extracts the pline vertex (defun pvtx (pl / pl ptt n1 n2 d1 d2) (setq lst (list)) (while (/= (cdr (assoc 0 (entget pl))) "SEQEND") (setq pl (entnext pl) ptt (cdr (assoc 10 (entget pl))) ) (if ptt (setq lst (append lst (list ptt))) ) )
Try to release the selection set memory using (GC) function after setting cset and parset nil. the use of GC will slow down the process but you can add conditions to call GC after some fixed interval. I think this will solve your problem. Give a try. Nirmal
Nirmal, Thanks for the suggestion. I tried the following at the end of each loop - before (setq no (1+ no)) in the above coding (clplb_clearselset)(gc) where clplb_clearselset function is as follows: (defun CLPLB_clearselset ( / i) (setq i 0) (foreach x (atoms-family 0) (if (/= x 'SSET) (if (= (type (eval x)) 'PICKSET) (progn (set x NIL) (setq i (1+ i)) ) ) ) ) (princ) ) Note: I am not clearing the SSET since this is required to be in loop. Unfortunately, I have NOT succeeded with this. Do you have any other suggestions on this issue? Thanks, MNRaghu
Thanks for the offer Nirmal, I think you can feel it only on the full version of the drawing. It is 11MB at its zipped version. Shall I send? Thanks, MNRaghu
I want to test only. So if you delete few entities not the boundary with which the features have to be broken, the file size will decrease. Actually I want to know what actually the scene is. Nirmal