I'm not sure what happens with the attached blocks, check the image, all of them are the same block, some of them has mirror text, I already tried everything, attsync, purge, resetblock, scale re-scale, etc.
I do not what happen, but the unique solution that found was to re-insert all blocks.
so I need a lisp for that.
When these block references were created, the UCS was rotated 180 ° around the Y-axis
Can we have sample DWG...
re-attached my dwg with the blocks that I need to re-insert with the name:
bug TEXT BLOCK EXPLODED.dwg
attached my dwg from where I created my previous drawing, selecting all blocks and exploding, then re-scaling to x1 y1 z1 , then the blocks appear as if they are mirrored, name of attached dwg:
bug ORIGEN OF BLOCKS.dwg
if you mean that I need to sample for the lisp, I just need to re-insert the same blocks in the same point, without mirrored text, with fixed ucs.
I think a sample might be export to csv, then import the csv for re-insert the blocks. attached below with name:
sample csv reinsert.csv
I can't open any of your drawings as they are in a later version to mine (2012). Are you sure none of these mirrored blocks have negative scale factors?
I am not one of the robots you're looking for
re-attached dwg samples in version AutoCAD 2010.
... and yes, none of the blocks were scaled to negative factors, that is why I think maybe a bug.
My tests show that the mirrored blocks have a -1.0 value for EffectiveXScaleFactor and XScaleFactor so you must assume that the bug is in the program that inserts the blocks.
I am not one of the robots you're looking for
No lisp is needed to fix this.
In some part of your drawing process some blocks were created by using MIRROR command. That is why they have scaleX and (or) scaleY set to -1- To fix this select all blocks and set those values to 1. In blocks there is also a text oriented upside down.
Miljenko Hatlak
@hak_vz wrote:No lisp is needed to fix this.
In some part of your drawing process some blocks were created by using MIRROR command. That is why they have scaleX and (or) scaleY set to -1- To fix this select all blocks and set those values to 1. In blocks there is also a text oriented upside down.
I already tried that, all those are the same blocks, are already scaled to "+1", I already tried to use BEDIT, REFEDIT, MIRRORTEXT, etc. then, what more should I do?
This is probably overkill but run this:
(defun rh:gbbc (obj / ll ur lst c_pt) (if (and obj (= (type obj) 'ENAME)) (setq obj (vlax-ename->vla-object obj))) (cond (obj (vlax-invoke-method obj 'getboundingbox 'll 'ur) (setq lst (mapcar 'vlax-safearray->list (list ll ur)) c_pt (mapcar '(lambda (x y) (/ (+ x y) 2.0)) (car lst) (cadr lst)) );end_setq ) );end_cond c_pt );end_defun (defun rh:mirr (obj pt lst / n_obj) (setq n_obj (vlax-invoke obj 'mirror pt (mapcar '+ pt lst))) (vla-delete obj) n_obj) (defun c:CBM ( / ss cnt obj i_pt c_pt x y z) (setq ss (ssget "_X" '((0 . "INSERT")))) (cond (ss (repeat (setq cnt (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq cnt (1- cnt)))) i_pt (vlax-get obj 'insertionpoint) c_pt (rh:gbbc obj) x (vlax-get obj 'XScaleFactor) y (vlax-get obj 'YScaleFactor) z (vlax-get obj 'ZScaleFactor) ) (cond ( (equal i_pt c_pt 0.1) (mapcar '(lambda (x) (if (minusp (vlax-get obj x)) (vlax-put obj x (abs (vlax-get obj x))))) '(XScaleFactor YScaleFactor ZScaleFactor) ) ) ( (if (minusp x) (setq obj (rh:mirr obj c_pt '(0.0 1.0 0.0)))) (if (minusp y) (setq obj (rh:mirr obj c_pt '(1.0 0.0 0.0)))) (if (minusp z) (setq obj (rh:mirr obj c_pt '(0.0 0.0 1.0)))) ) ) );end_repeat ) );end_cond )
As @hak_vz mentioned you can also select all the mirrored blocks and type properties and the command line
You will see that the x has a -1 click in this box and set to 1
I am not one of the robots you're looking for
When I open your drawing all blocks have wrong orientation. Just by opening properties window, selecting all block and setting values scaleX and Scale Y to 1 puts them in good orientation, at least text TD.
Miljenko Hatlak
I have found problem. Don't know the reason why this happen but.
All wrong blocks appear flipped but I didn't find that flipping has been used in block edit.
Here is what has to be done.
For the block
Change extrusion direction from (210 0 0 -1) to (210 0 0 1)
Change insertion point from (10 -x y 0) to (10 x 0)
Here is a non tested code. It's time to go to bed.
(defun c:repblk ( / ent x y z ) (setq e (car (entsel "\n Select block >")) ent (entget e)) (mapcar 'set '(x y z) (cdr (assoc 10 ent))) (setq ent (subst (cons 10 (list (* -1 x) y z)) (assoc 10 ent) ent)) (entmod ent) (setq ent (subst (cons 210 (list 0 0 1)) (assoc 210 ent) ent)) (entmod ent) (setq e (entnext e) ent (entget e)) (mapcar 'set '(x y z) (cdr (assoc 10 ent))) (setq ent (subst (cons 10 (list (* -1 x) y z)) (assoc 10 ent) ent)) (entmod ent) (setq ent (subst (cons 210 (list 0 0 1)) (assoc 210 ent) ent)) (entmod ent) (princ) )
Miljenko Hatlak
Worked for my on your supplied drawing.
I am not one of the robots you're looking for
thanks for answer.
it is a good start.
but when the block has rotation does not work correctly.
the orientation for text was mirrored to the square block.
it is there any way to select all or some blocks?
I ran the posted lisp on the origin dwg, and then no problems appeared as the blocks were exploded.
Your problem may be related to the alignment parameter of the innermost block. This is configured 180 degrees from the x normal, and is away from the block insertion point. This block is then scaled up and nested in another block, which in turn is nested inside another block, and so on, and therein lies the problem.
I am not one of the robots you're looking for
thanks for the answer.
I was testing in the "Origen dwg". applying your lisp individually fix the position, then I can explode with problems.
but I need to keep the position and rotation (without the mirrored bug).