Mirroring models? - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html) +--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html) +--- Thread: Mirroring models? (/thread-21893.html) |
Mirroring models? - Michael Horvath - 2016-11-02 Is there a tool I can use to mirror a model across an axis? I couldn't find such a command in MLCad. Thanks. RE: Mirroring models? - Kevin - 2016-12-05 (2016-11-02, 5:39)Michael Horvath Wrote: Is there a tool I can use to mirror a model across an axis? I couldn't find such a command in MLCad. Your question intrigued me, so I started playing around in Python to try to create a mirror of one of my recent 1300-part mpd files. This turns out not to be a trivial exercise. It's easy enough to mirror the location of the parts, but not so easy to mirror the rotation. For any given mirroring, different parts will require different rotations to achieve perfect reflection. And this inconsistency is independent of any rotation applied to the part within an assembly. For example, take the simple case of a 1x12 Technic brick with a 2x2 corner plate on one end: The assembly on the left has two pieces placed with no rotation about any axis. The assembly on the right has the same two parts mirrored through the x=0 plane. The Technic brick requires no rotation at all to be a true reflection, and will also be a reflection if rotated 180 degrees about the y-axis. However, the 2x2 corner plate will only be a reflection if rotated about the y-axis 90 degrees counter-clockwise (or 270 degrees clockwise). Clearly there is not a single rule that can be applied to these parts to achieve a perfect reflection of the assembly through the x=0 plane. It was easy to write a simple program to do mirror parts with a basic (but frequently incorrect) assumption about rotation: for reflections through the x=0 plane, reverse rotations about the y and z axes. This gives a fairly good result, but it would still take some manual effort to clean up the resulting model into the final result you would be looking for. I believe reflections through the y=0 and z=0 planes will be similar. If you're interested, I'd be happy to provide my program or run your file through it myself to produce the first cut at a mirror that you can then edit yourself. Kevin RE: Mirroring models? - Roland Melkert - 2016-12-06 (2016-11-02, 5:39)Michael Horvath Wrote: Is there a tool I can use to mirror a model across an axis? I couldn't find such a command in MLCad.LDCad 1.6 has a mirroring feature, if mirrors around the current (relative) grid's x, y or z axis. It's not perfect for all parts though for the very same reason Kevin wrote. (2016-12-05, 12:00)Kevin Wrote: Your question intrigued me, so I started playing around in Python to try to create a mirror of one of my recent 1300-part mpd files. This turns out not to be a trivial exercise.I discovered this same problem while working on LDCad 1.6 basically it means any part needs to be symmetrical along at least one of its axis (the x axis seems to be just that for most parts though). If not a custom additional (pre) rotation is probably needed. And then there are parts like the left/right wings etc. I solved this by adding shadow info to some parts (just like with snapping data). But I haven't had the time to add that for all non symmetric parts. RE: Mirroring models? - Don Heyse - 2016-12-25 (2016-11-02, 5:39)Michael Horvath Wrote: Is there a tool I can use to mirror a model across an axis? I couldn't find such a command in MLCad. It's my annual Christmas holiday catchup on ldraw, so I'd like to hijack this thread just a bit late and talk about the good ole days. I hope that's ok. A long time ago, in a forum far, far away we dreamed up a tool to do just this. But that forum eventually fell from favor and many ideas both good and not so good were lost. This link is from somewhere near the end of a long, and interesting discussion on the topic of mirroring ldraw models. There were other such discussions in the CAD and MLCAD groups. http://news.lugnet.com/cad/?n=11677 I'm not sure which bucket mirwiz falls into, but it's out there, with some fairly simple C code. The basic idea is to maintain a mirror.ini file that tells how to mirror via a rotation or part substitution for all the parts in ldraw library. The mirror.ini file in the zip archive was up to date as of sometime in 2004. It should be self documenting if you read the comments at the top. Enjoy, Don |