To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 11579
11578  |  11580
Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 15:20:23 GMT
Viewed: 
1794 times
  
In lugnet.cad, Dave Schuler wrote:
In lugnet.cad, Steve Krass wrote:
In lugnet.cad, Carl Nelson wrote:
Does anybody know a quick way to do a mirror image of an LDraw
model?  For example, a castle that I'm working on has a left and
right tower that are mirror images (not rotations) of each other
(and the rear corner towers are mirrors of the front ones).
Rather than make 4 different models, is there a quick way to flip
my model into the four different towers?

I usually use submodels save your tower as a tower-left or
something.  you have to go thruogh each part and change either the
x or z value to the opposite value (ex. if the X is -300 change to
300) then rotate each part 180 degrees.  There are also a lot of
left and right parts which need to be swaped.

or in povray you can use scale with a negative value
(ex. scale<-1,0,0> ) this will mirror around the x axis.

There is no easy way.

The way I usually do this is clunky, but it basically works.  It
also requires a little familiarity with MS Excel and some kind of
text editor, as well as an understanding of the LDraw DAT-file
format.

Create a backup of the MOC file.  Open the backup file in MS Excel,
in "space delimited" format.  For simplicity, let's assume the
following:

1.  Any title info within the DAT file is omitted for this operation
2.  The ZERO character in line one at the start of the file appears in
    cell A1 in the Excel spreadsheet
3.  The first linetype 1 statement begins in cell B2 in the Excel
    spreadsheet

Here's how I do what I do when I do it:

For simple mirroring of the parts from left-to-right.  This only
works for parts oriented along the X, Y, and Z axes.  If parts are
rotated at odd angles (like 30 degrees, or whatever), then this
won't quite work, but it should get you started.

1.  Identify which lines contain the parts of the model that you
    want to mirror (let's say lines 2 through 50).
2.  Copy these lines to another location in the file (let's say 51
    through 99)
3.  Set cell D51 to equal "-D2"
4.  Select cell D51 and "copy"
5.  Select cells D52 through D99
6.  Paste

At this point the parts now exist in their original locations and at
the corresponding mirrored locations, but the mirrored locations are
not oriented correctly.  To correct the orientation, do the
following:

1.  Select cell D51 and "copy"
2.  Select cells G51 through G99
3.  Paste

This will invert the orientation left-to-right and vice versa.

To perform the same mirroring front-to-back, perform the same steps
as above, but instead of using columns D and G, you'd use columns F
and O, respectively.

To perform the same mirroring up-to-down, perform the same steps as
above, but instead of using columns D and G, you'd use columns E and
K, respectively.

After you have made all of your changes, save the Excel spreadsheet
in tab-delimited format, and use the .DAT extension in the file
name, such as "MOC1.dat" • L
At this point, the body of the MOC1.dat file has a bunch of tab
characters where there should be spaces.  Open the MOC1.dat file in
a text-based editor that allows you to do bulk find-replace
operations, and replace each of the "tab" characters with a single
space.

Save the file and open it in your LDraw platform of choice to view
the results.

Here's a Known Shortcoming of this method: it doesn't automatically
accommodate linetype zero statements that appear within the body of
the DAT file, nor does it automatically accommodate METASTATEMENTS.
You'll need to tweak those manually if they present a problem.

I apologize if my explanation is unclear, but I can attest to the
effectiveness of the method, because I've used it dozens of times
for model files and for new partfiles.  Let me know if you'd like
clarification on any point.

This is silly.  Just put the structure you want to mirror in a
subfile and do this.

  1 0 0 0 0 1 0 0 0 1 0 0 0 1 subfile.ldr
  1 0 320 0 0 -1 0 0 0 1 0 0 0 1 subfile.ldr

You can do it in ldglite using the scale by (-1,1,1) command (just
like in POV).  Then use your favorite CAD program to position the part
and it's mirror wherever you want them.  If you like, inline them
both.  That'll generate pictures that look correct.  The only problem
will be if you use the LDR file to generate an inventory list and you
have distinct left and right parts like wing plates.

Don



Message has 2 Replies:
  Re: Quick way to mirror-image a model?
 
(...) Oops, wrong color. That should be 1 16 0 0 0 1 0 0 0 1 0 0 0 1 subfile.ldr 1 16 320 0 0 -1 0 0 0 1 0 0 0 1 subfile.ldr just in case... Enjoy, Don (20 years ago, 17-Jun-04, to lugnet.cad)
  Re: Quick way to mirror-image a model?
 
(...) Won't that cause all of the LEGO logo on all of the studs in the mirrored parts to be reversed? I thought that part of the point of the question was to avoid that. I think that measures are being taken to correct the mirrored-logo issue, but (...) (20 years ago, 17-Jun-04, to lugnet.cad)

Message is in Reply To:
  Re: Quick way to mirror-image a model?
 
(...) The way I usually do this is clunky, but it basically works. It also requires a little familiarity with MS Excel and some kind of text editor, as well as an understanding of the LDraw DAT-file format. Create a backup of the MOC file. Open the (...) (20 years ago, 17-Jun-04, to lugnet.cad)

65 Messages in This Thread:

















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR