Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Combine or Merge two Lisp

1 REPLY 1
Reply
Message 1 of 2
mmapss
687 Views, 1 Reply

Combine or Merge two Lisp

May I ask for help combining two routines?
I have attached a file containing both lisp routines.

The first lisp will Change Elevation of selected objects based on the elevation of another selected object.
The second lisp will select all entities within a selected entity.

In the first lisp the user is asked, "Select object from which to extract the Elevation:"
I would like for this same object to be the object of which, all entities within are selected.

Resulting in picking only one object one time, then all entities within this same object
have their elevation changed to the first selected object's elevation.

If I am asking too much. I understand.
Respectfully,
Victor
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: mmapss

;;not test!

;; Changes Elevation of Entities based on the Elevation of another selected
entity.
;; The selected entity must be a LWPolyline.
;; These changed entities are then changed to Color Red, to show the edit.
(defun C:CE (/ ENTITY1 OE OLDCE OLDERR OLDTE SS)
;; Save the current value of cmdecho then redefine it.
(setq OLDCE (getvar "cmdecho"))
(setvar "cmdecho" 1)
;; Save the current value of texteval then set it to 1
(setq OLDTE (getvar "texteval"))
(setvar "texteval" 1)
;; Save the current value of the error handling subroutine then redefine
it.
(setq OLDERR *ERROR*)
(defun *ERROR* (ERRMES)
(princ
(strcat "\nExecution of CL halted by the following error: "
ERRMES
)
)
(setvar "cmdecho" OLDCE)
(setq *ERROR* OLDERR)
(prin1)
)
;;(setq *error* nil)
;; NOTE: to turn error handling off, erase the semicolon in the line
above.

;; GET a ENTITY from the user and store it in ENTITY1.
(setq ENTITY1
(car
(entsel
"\nSelect object from which to extract the Elevation: "
)
)
)

;; EXTRACT the Elevation from the entity ENTITY1 and store it in LN.
(setq OE (cdr (assoc 38 (entget ENTITY1))))
(setq SS (SSIN ENTITY1))
;; Input to AutoCAD's command line.
(command "_.change" SS "" "P" "E" OE "C" "R" "")
;; Reset "cmdecho" to previous value.
(setvar "cmdecho" OLDCE)
;; Reset "texteval" to previous value.
(setvar "texteval" OLDTE)
;; Reset *error* to previous definition.
(setq *ERROR* OLDERR)
;; Exit quietly (no return value.)
(prin1)
)


;;
==========================================================================
;; Task: Select all the objects that fall within (or that cross) a
selected
;; objects internal boundaries, e.g., polyline, polygon, circle,
etc.
;;
;; Returns: Object selection set if called transparently during a command.
;; It creates a pickfirst selection if called outside a command.
;;
;; Comments: This function depends on Express Tools functions that should
already
;; be loaded and active. The selected object may need to be
mostly
;; on-screen or the selection of objects within that area may
fail.
;;
==========================================================================
(defun SSIN (BOUNDOBJ / OBJLIST PIXELSIZE SSCONTENTS SSRET)
(setq SSRET (princ))
(if BOUNDOBJ
;;(setq SSBOUNDS (ssget "_:s"))
(progn
(if (and
;;(setq BOUNDOBJ (ssname SSBOUNDS 0))
(setq PIXELSIZE (ACET-GEOM-PIXEL-UNIT))
(setq
OBJLIST (ACET-GEOM-OBJECT-POINT-LIST BOUNDOBJ PIXELSIZE)
)
(setq OBJLIST (ACET-LIST-REMOVE-DUPLICATES
OBJLIST
(/ PIXELSIZE 0.25)
)
)
;; if you prefer to use the WP option, change this line to call "_WP"
instead of "_CP"
(setq SSCONTENTS (ssget "_CP" OBJLIST))
)
;;and
(progn
;; remove the selected object from the set
(if (ssmemb BOUNDOBJ SSCONTENTS)
(setq SSCONTENTS (ssdel BOUNDOBJ SSCONTENTS))
)
;;if
;;(if (equal (getvar "cmdnames") "")
;;(setq SSRET (princ))
(setq SSRET SSCONTENTS)
;;)
;;if
)
;;progn
)
;;if
;;(if (equal (type SSRET) 'SYM)
;;(sssetfirst SSCONTENTS SSCONTENTS)
;;)
;;if
)
;;progn
)
;;if
SSRET
)


--
福信科技
LUCAS

撰寫於郵件新聞:6220028@discussion.autodesk.com...
May I ask for help combining two routines?
I have attached a file containing both lisp routines.

The first lisp will Change Elevation of selected objects based on the
elevation of another selected object.
The second lisp will select all entities within a selected entity.

In the first lisp the user is asked, "Select object from which to extract
the Elevation:"
I would like for this same object to be the object of which, all entities
within are selected.

Resulting in picking only one object one time, then all entities within this
same object
have their elevation changed to the first selected object's elevation.

If I am asking too much. I understand.
Respectfully,
Victor

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost