Author Topic: Mirrored Block  (Read 2604 times)

0 Members and 1 Guest are viewing this topic.

lightname

  • Guest
Mirrored Block
« on: September 02, 2008, 04:54:26 PM »
Is there a way to insert a mirrored block? If not can I insert it, then select it and finally mirror it?

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Mirrored Block
« Reply #1 on: September 02, 2008, 06:06:51 PM »
Make the x, y or z value negative when you insert it.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Mirrored Block
« Reply #2 on: September 02, 2008, 08:00:36 PM »
If you do need to mirror it after insertion, I've found you need to use a rotation matrix rather than a mirror whatever.
edit; Mirror it about a picked point using the x-axis as a vector and rotate about that same point using the following math.
Below is the guts part of a mirror function
Code: [Select]
protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {

                if (mir)
                {
                    Vector3d V = Cs.Xaxis;
                    Plane P = new Plane(M1, V);
                    transMat = Matrix3d.Mirroring(P);
                    NewAng = Math.PI * 0.5;
                    mir = false;
                }
                else
                    transMat = Matrix3d.Rotation((NewAng - Ang)*2, Pn.Normal, M1);

                Ang = NewAng;
                foreach (Entity draggingEntity in m_entitiesToMirror)
                {
                    draggingEntity.TransformBy(transMat);
                    draw.Geometry.Draw(draggingEntity);
                }
                return true;
            }  //End WorldDraw
« Last Edit: September 02, 2008, 09:55:01 PM by Bryco »

lightname

  • Guest
Re: Mirrored Block
« Reply #3 on: September 04, 2008, 05:40:20 AM »
mohnston: Thank you, that was just what I needed. So simple, yet I'd never have thought of it myself.

Alan Cullen

  • Guest
Re: Mirrored Block
« Reply #4 on: September 04, 2008, 06:46:38 AM »
lightname,

I'm probably a bit late here.....but yes you can mirror a block......but any text in the block also gets mirrored, irrespective of the setting of MIRRTEXT.