View Full Version : Mirror Routine ??
madcadder
2005-06-14, 06:28 PM
Does anyone have a routine that:
mirrors an object
around the midpoint of the view limits of the object
in a single click.
madcadder
2005-06-14, 08:14 PM
I'll take it that no one has a pre made routine already...
So..
I snagged this from BOXTEXT.LSP as my source to get me started.
I've tested on lines and it draws a box around the object from lower left to upper right, but I need it to work on an xref or a block. It doesn't.
What is missing or needs to be changed to allow an xref as my selection:
(this is a vlisp lesson for me)
(DEFUN c:flipit (/)
(VL-LOAD-COM)
(COMMAND "undo" "begin")
(SETQ eobj (VLAX-ENAME->VLA-OBJECT
(CAR (NENTSEL "nSelect Object: "))
)
)
(IF (NOT (VL-CATCH-ALL-ERROR-P
(VL-CATCH-ALL-APPLY
'(LAMBDA (x) (VLA-GETBOUNDINGBOX x 'pt1 'pt2))
(LIST eobj)
)
)
)
(PROGN
(SETVAR "osmode" 0)
(VL-CMDF "rectang"
(VLAX-SAFEARRAY->LIST pt1)
(VLAX-SAFEARRAY->LIST pt2)
)
)
)
(COMMAND "undo" "end")
(PRINC)
)
I think here need to change NENTSEL by ENTSEL
Xref is the complex ENTITY and nentsel returns the same information
as SUBENTITY list
Sorry for my bad English
Thanks
Try this one
Thanks
(defun c:mirr-yaxis (/)
(vl-load-com)
(setq adoc
(vla-get-activedocument
(vlax-get-acad-object)
)
appd (vla-get-application adoc)
acsp (vla-get-block (vla-get-activelayout adoc))
)
(vla-startundomark adoc)
(if
(setq eobj (vlax-ename->vla-object
(car (entsel "nselect object: "))
)
)
(progn
(if (not (vl-catch-all-error-p
(vl-catch-all-apply
'(lambda (x) (vla-getboundingbox x 'pt1 'pt2))
(list eobj)
)
)
)
(progn
(setq pn1 (vlax-safearray->list pt1)
pn2 (vlax-safearray->list pt2)
pc (mapcar '* (mapcar '+ pn1 pn2) (list 0.5 0.5 0.5))
pc1 (list (car pc)(+ (cadr pc) 1.) (caddr pc))
)
(setq nobj (vla-mirror
eobj
(vlax-3d-point pc)
(vlax-3d-point pc1)
)
)
(vla-delete eobj)
(mapcar 'vlax-release-object (list eobj nobj))
)
)
)
)
(vla-zoomwindow acapp pt1 pt2)
(vla-endundomark adoc)
(princ)
)
(c:mirr-yaxis)
madcadder
2005-06-14, 10:45 PM
I think here need to change NENTSEL by ENTSEL
Xref is the complex ENTITY and nentsel returns the same information
as SUBENTITY list
Sorry for my bad English
Thanks
You fixed the problem. I changed NENTSEL to ENTSEL and I now have a box drawn around the XREF. Time to finish the rest of the program.
Thank you,
madcadder
2005-06-14, 10:53 PM
Try this one
Even better.. That does exactly what I was going to do.
Thank you,
Tod
madcadder
2005-06-14, 11:09 PM
Finished LISP file with MIRROR to X or Y axis.
Command line of MX or MY to run.
Mr Cory
2007-09-05, 04:58 AM
Hey guys is there anyway to get this to work for multiple objects?
ccowgill
2007-09-05, 01:17 PM
NENTSEL allows you to only select one object at a time due to what it passes on. you can read up on it in help. It would be nice if there was a way to provide the same functionality with multiple objects. the expresstool nested copy would be awesome if I could select objects using a window.
Mr Cory
2007-09-06, 12:39 AM
Dam thats a shame, it would be perfect for flipping leaders, have to think of another way to do it
madcadder
2007-09-07, 06:10 AM
Dam thats a shame, it would be perfect for flipping leaders, have to think of another way to do it
Workaround:
Search for CLEA.lsp
With it you can select a source leader and change all the destination leaders to read the same. If it happens to be facing the other direction, so be it.
Mr Cory
2007-09-07, 06:45 AM
Workaround:
Search for CLEA.lsp
With it you can select a source leader and change all the destination leaders to read the same. If it happens to be facing the other direction, so be it.
That just matches the contents of the text though :?
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.