Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
; Function to transfer the rotation of a selected text and the maximum x value to selected text (defun C:Max (/ lstAreas lstInsertion lstInsertions lstObjects lstSelections objSource sngMax sngRotation ssSelections) (if (and (print "Select Source Text first and text to change after: ") (setq ssSelections (ssget (list (cons 0 "text")))) (setq lstSelections (SelectionSetToList ssSelections)) (setq lstObjects (mapcar 'vlax-ename->vla-object lstSelections)) (setq objSource (car lstObjects)) (setq sngRotation (vla-get-rotation objSource)) (setq lstObjects (cdr lstObjects)) (setq lstInsertions (mapcar '(lambda (X)(vlax-get X "insertionpoint")) lstObjects)) (print (length lstObjects)) (setq lstInsertion (vlax-get objSource "insertionpoint")) (setq sngMax (car lstInsertion)) ;(setq sngMax (apply 'max (mapcar 'car lstInsertions))) ) (apply 'and (mapcar '(lambda (X)(textfix X sngRotation (list sngMax nil nil))) lstObjects)) ) ) ; Function to change the rotation and set the x coordinate to be a specified value (defun TextFix (objText sngRotation lstMaximas / lstInsertion) (and (errortrap (quote (vla-put-rotation objText sngRotation))) (setq lstInsertion (vlax-get objText "insertionpoint")) (setq lstInsertion (mapcar 'OrValue lstMaximas lstInsertion)) (errortrap (quote (vlax-put objText "insertionpoint" lstInsertion))) ) ) ; Function for substituting a value for a nil in a pair of lists (defun OrValue (sngValue1 sngValue2) (if sngValue1 sngValue1 sngValue2) ) ;Function to convert a lisp selection set into a list of entities (defun SelectionSetToList (ssSelections / intCount entSelection lstSelections) (repeat (setq intCount (sslength ssSelections)) (and (setq intCount (1- intCount)) (setq entSelection (ssname ssSelections intCount)) (setq lstSelections (cons entSelection lstSelections)) ) ) lstSelections ) ; Function to trap lisp errors (defun ErrorTrap (symFunction / objError result) (if (vl-catch-all-error-p (setq objError (vl-catch-all-apply '(lambda (X)(set X (eval symFunction))) (list 'result)))) nil (if result result 'T) ) ) (vl-load-com)
I found a list from AUGI forum that matches x cordinates of two texts, is it possible at least to also work with mtext? if it would work with things like blocks, circles, etc. would be great too.
Also next I would need a MAY lisp to do the same for Y cordinates.
Solved! Go to Solution.