I'm trying to make my custom command that mirrors all the entities (lines, blocks, etc.).
I used this:
http://through-the-interface.typepad.com/through_the_interface/2008/10/mirroring-autoc.html
I have one problem. After mirroring the line or polyline if I show list of parameters (LIST command) I have this:
Extrusion direction relative to UCS: X= 0.0000 Y= 0.0000 Z= -1.0000
The problem is that I cannot then stretch this line if I select line and block in one time.
Can anyone help me? How can I get rid of this "Extrusion ...".
With simple mirror I doesn't have this problem.
simple mirror is 2d mirror, what you are doing here is 3d mirroring, that's why you get opposite extrusion direction, which is the same as normal vector of the object
you can try something like this:
Dim ent2 As Line = ent.Clone ent2.TransformBy(Matrix3d.Mirroring(New Line3d(New Point3d, New Point3d(0, 1, 0)))) ent2.Normal = ent.Normal
It doesn't work for me.
Here is my code:
public ObjectId MirrorEntity(ObjectId id, Point3d firstPoint, Point3d secondPoint) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; DocumentLock dl = doc.LockDocument(DocumentLockMode.ProtectedAutoWrite, null, null, true); using (dl) { using (Transaction tr = db.TransactionManager.StartTransaction()) { try { Entity ent = tr.GetObject(id, OpenMode.ForRead) as Entity; Entity me = ent.Clone() as Entity; Line3d line = new Line3d(firstPoint.Add(this.BasePoint3d.GetAsVector()), secondPoint.Add(this.BasePoint3d.GetAsVector())); Matrix3d mm = Matrix3d.Mirroring(line); me.TransformBy(mm); BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite); ObjectId newId = btr.AppendEntity(me); tr.AddNewlyCreatedDBObject(me, true); tr.Commit(); return newId; } catch (Autodesk.AutoCAD.Runtime.Exception ex) { Utilities.ErrorMessage("\nException!\n " + ex.Message); tr.Abort(); return ObjectId.Null; } } } }