Visual LISP, AutoLISP and General Customization

Reply
Active Member
mmapss
Posts: 8
Registered: ‎09-26-2008
Message 1 of 2 (177 Views)

Combine or Merge two Lisp

177 Views, 1 Replies
07-16-2009 06:19 PM
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
*LUCAS
Message 2 of 2 (177 Views)

Re: Combine or Merge two Lisp

07-16-2009 08:40 PM 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)
;:smileywink:
;;if
)
;;progn
)
;;if
;;(if (equal (type SSRET) 'SYM)
;;(sssetfirst SSCONTENTS SSCONTENTS)
;:smileywink:
;;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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community