map_dwgbreakobj

AutoCAD Map 3D AutoLISP

Up a level
map_dwgbreakobj
 
 

Breaks linear objects where they cross boundaries.

(map_dwgbreakobj sscut boundary skiptopo keepod)

Returns a selection set of objects cut by the operation or nil.

sscut Selection set of objects to cut.
boundary Object name of a single object or a selection set of multiple objects. Valid objects: line, polyline, circle, arc
skiptopo Skip flag:
1 Skip objects referenced by a topology
0 Trim objects referenced by a topology
keepod Keep flag that sets whether to keep object data of clipped objects in result object:
1 Retain all object data on any clipped object
0 Drop object data on any clipped object

This function cuts linear objects, such as lines, polylines, circles, and arcs, that cross the selected boundary. Unlike the map_dwgtrimobj function, this function does not delete the parts of the object on either side of the boundary. For example, you could mark a boundary and divide one map into two section maps along this boundary.

The following example prompts you to select an object to break and make choices about the break operation. It includes error reporting.

(prompt "\nSelect object to break :")
(setq sscut (ssget))
(if sscut (progn
      (setq boundary 
            (car (entsel "\nSelect boundary object "))) 
      (if boundary (progn 
            (initget "Yes No") 
            (setq kword 
                        (getkword "\nSkip objects referenced 
                         by a topology Yes/No <Yes> : ")) 
            (if (or (null kword) (= kword "Yes")) 
                  (setq skiptopo 1) 
                  (setq skiptopo 0) 
            ) 
            (initget "Yes No") 
            (setq kword 
                        (getkword "\nRetain object data 
                         Yes/No <Yes> : ")) 
            (if (or (null kword) (= kword "Yes")) 
                  (setq keepod 1) 
                  (setq keepod 0) 
            ) 
            (setq result (map_dwgbreakobj 
                                 sscut 
                                 boundary 
                                 skiptopo 
                                 keepod)) 
            (if result 
                  (prompt "\nObject(s) break successfully.") 
                  (progn 
                        (setq nberr (ade_errqty) i 0) 
                        (repeat nberr 
                              (prompt (strcat 
                                    "\nError " (rtos i 2 0) " of " 
                                    (rtos nb 2 0) 
                                    " : " 
                                    (ade_errmsg i))) 
                              (setq i (1+ i)) 
                        ) 
                  ) 
            ) 
      )) 
))