Clipping of huge drawing

Discussion in 'AutoCAD' started by RaghuMN, Mar 17, 2005.

  1. RaghuMN

    RaghuMN Guest

    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)))
    )
    )
     
    RaghuMN, Mar 17, 2005
    #1
  2. RaghuMN

    Nirmal Guest

    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, Mar 17, 2005
    #2
  3. RaghuMN

    RaghuMN Guest

    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
     
    RaghuMN, Mar 17, 2005
    #3
  4. RaghuMN

    Nirmal Guest

    Can you send me 1 sample DWG file at ? So that I may find the solution.

    Nirmal
     
    Nirmal, Mar 17, 2005
    #4
  5. RaghuMN

    RaghuMN Guest

    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
     
    RaghuMN, Mar 18, 2005
    #5
  6. RaghuMN

    Nirmal Guest

    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
     
    Nirmal, Mar 18, 2005
    #6
  7. RaghuMN

    RaghuMN Guest

    Nirmal,

    I have sent the sample and the lisp file for your reference.

    Thanks,

    MNRaghu
     
    RaghuMN, Mar 18, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.