SLAB_FROM_POLYLINE_v1.................................free

Command: SFP

This function converts closed polyline to a slab (AEC_SLAB object type). The Program is written for Autocad MEP/ Autocad Architecture.

 

Code:

;;; =================================================
;;;        SLABFROMPOLYLINE_v1_00.LSP
;;;
;;;        Written by Andrzej Kalinowski
;;;        v1.00 - 14.08.2016
;;;
;;;        Command: SFP - converts closed polyline to a architecture slab (Autocad Architecture object)
;;;        
;;; =================================================
(defun c:SFP (/ obj1 TYP1)
    ;-----------------------------------------
    ;selection of polyline
    ;-----------------------------------------
    (setq obj1 nil)
    (prompt "\nSelect object ")
    (while (= obj1 nil)
        (setq obj1 (ssget "_+.:S"))
        (if (= obj1 nil)
            (princ "\nWrong object");then
            (if (> (sslength obj1) 1);else-checks if only 1 object is selected
                 
                (progn ;gdy wybrano za duzo obiektow
                    (princ "\nSelect only one object")
                    (setq obj1 nil)
                );progn
                     
                (progn ;else
                    (setq obj1 (ssname obj1 0))
                    ;takes first and only one element from selection set. You can retreive entlist from element of seleset - not from selset.
                    (setq TYP1 (cdr (assoc 0 (entget obj1) ) ) );end setq
                    (if (/= TYP1 "LWPOLYLINE")
                        (progn
                            (prompt "\nWrong object")
                            (setq obj1 nil)
                        ); progn
                    ); if 
                );progn else
            );end if
        );end if
    );end while
    ;-----------------------------------------
    ;converting to slab
    ;-----------------------------------------
    (command "_slabconvert" obj1 "" "_y" "_Direct" "_Bottom" "0,0,0" )
    ;-----------------------------------------
    (princ);exiting quietly
);defun

Example:

Download file: SLAB_FROM_POLYLINE_v1.FAS

No comments:

Post a Comment