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
Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 15:20:23 GMT
Viewed: 
1662 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


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 15:27:25 GMT
Viewed: 
1665 times
  
In lugnet.cad, Don Heyse wrote:
In lugnet.cad, Carl Nelson wrote:
Does anybody know a quick way to do a mirror image of an LDraw
model?

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

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


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 15:39:49 GMT
Viewed: 
1733 times
  
In lugnet.cad, Don Heyse wrote:

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.

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 I'd prefer a more organic solution instead.  YMMV.

Also, no kidding you can create a sub-file and do a matrix switcheroo to mirror
it, but what if you want to have slight modifications to each of the four castle
towers?  Your method won't help at all in that case, unless you wanted to create
four separate sub-files, altering each as desired, and then inlining them, but
that doesn't seem an appreciably better solution that what I proposed.  Using my
method, the whole mirrored tower is accessible for modification, and you don't
have to worry about mirroring any complex structures, since you'll be building
them in true orientation.

While I'm at it, your method will certainly work to an extent, but the method I
described has the benefit of functioning without inlined sub-files, and it works
just as well it partfiles or model files.

If this method seems silly to you, may I suggest that you not use it?

Dave!


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 15:52:23 GMT
Viewed: 
1829 times
  
In lugnet.cad, Dave Schuler wrote:
  [snip]
If this method seems silly to you, may I suggest that you not use it?

Bad choice of words "silly".  Sorry about that, but he asked for a
"quick" way to do it.  He used the word "quick" twice in fact.  But
everyone seemed intent on providing a thorough, but complex method
without first telling the quick and dirty way.  There are plenty of
newbies out there who don't know it.

Have fun,

Don


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 16:25:30 GMT
Viewed: 
1843 times
  
In lugnet.cad, Don Heyse wrote:
In lugnet.cad, Dave Schuler wrote:
  [snip]
If this method seems silly to you, may I suggest that you not use it?

Bad choice of words "silly".  Sorry about that, but he asked for a
"quick" way to do it.  He used the word "quick" twice in fact.  But
everyone seemed intent on providing a thorough, but complex method
without first telling the quick and dirty way.  There are plenty of
newbies out there who don't know it.

Fair enough--I guess "quick" is in the eye of the beholder.  8^)

Dave!


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Thu, 17 Jun 2004 23:49:56 GMT
Viewed: 
1751 times
  
In lugnet.cad, Dave Schuler wrote:
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

If this bothers you, a partial solution is here:

http://news.lugnet.com/cad/dev/?n=9067

While the results from running the program aren't really appropriate for
distribution to others, you can at least do your own POV renderings (as long as
you don't use -lgeo).  Additionally, the stud logos should always look correct
in both LDView and LDGLite, since both programs automatically detect mirrored
studs and un-mirror them.

--Travis


Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Fri, 18 Jun 2004 00:31:13 GMT
Viewed: 
1812 times
  
In lugnet.cad, Don Heyse wrote:
In lugnet.cad, Dave Schuler wrote:
  [snip]
If this method seems silly to you, may I suggest that you not use it?

Bad choice of words "silly".  Sorry about that, but he asked for a
"quick" way to do it.  He used the word "quick" twice in fact.  But
everyone seemed intent on providing a thorough, but complex method
without first telling the quick and dirty way.  There are plenty of
newbies out there who don't know it.

Have fun,

Don

I didn't necessarily mean quick, I meant easy.  Hey, I'm lazy. ;-)

I like both answers because you gave me what I needed to know to accomplish the
task quickly, Dave gave me what I needed to know to understand what I'm doing!

Carl


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